15,922,427 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by asmaa elbattanony (Top 4 by date)
asmaa elbattanony
25-Jan-12 10:33am
View
Thanx Kishorekke
Your Solution Worked like a charm ^_^
asmaa elbattanony
27-Jul-11 8:42am
View
Just because its my first time to make a post in here and i made some mistakes now this means that I'm stupid???
OK well thank you for your (GREAT HELP)
I'm waiting for someone who can actually help me though
asmaa elbattanony
26-Jul-11 11:46am
View
Deleted
Shameel
Thank u for your help
i made something like your idea
but still nothing
here is my code(display method,next button and previous button actions)
////////////////////////DISPLAY METHOD///////////////////////////////
public void display()
{
DataRow dr=t.Rows[n];
Label3.Text=dr["q"].ToString();
RadioButtonList1.Items[0].Text = dr["a1"].ToString();
RadioButtonList1.Items[1].Text = dr["a2"].ToString();
RadioButtonList1.Items[2].Text = dr["a3"].ToString();
RadioButtonList1.Items[3].Text = dr["a4"].ToString();
Label4.Text = dr["c_ans"].ToString();
int index;
if (Session["selected"] != null)
{
index = RadioButtonList1.Items.IndexOf(RadioButtonList1.Items.FindByText(selected));
}
else
{
index = RadioButtonList1.Items.IndexOf(RadioButtonList1.Items.FindByText(dr["s_ans"].ToString()));
}
Response.Write(index);
RadioButtonList1.Items[index].Selected = true;
}
////////////////////////NEXT METHOD///////////////////////////////
protected void Button2_Click(object sender, EventArgs e)
{
try
{
Button1.Enabled = true;
Label4.Visible = false;
n = n + 1;
// selected = (string)Session["selected"];
string sql = "update questions set s_ans='" + selected + "' where q='" + Label3.Text + "'";
Response.Write(sql);
comm = new SqlCommand(sql, conn);
int x = comm.ExecuteNonQuery();
if (n >= t.Rows.Count - 1)
{
Button2.Enabled = false;
}
Session["selected"] = selected;
RadioButtonList1.SelectedIndex = -1;
Session["n"] = n;
display();
}
catch (Exception ex)
{
Label4.Visible = true;
Label4.Text = "Please Choose an answer "+ex.Message;
}
}
////////////////////////prev METHOD///////////////////////////////
protected void Button1_Click(object sender, EventArgs e)
{try
{
Button2.Enabled = true;
Label4.Visible = false;
// selected = (string)Session["selected"];
n = n - 1;
if (n == 0)
{
//n = 0;
Button1.Enabled = false;
}
string sql = "update questions set s_ans='" + selected + "' where q='" + Label3.Text + "'";
Response.Write(sql);
comm = new SqlCommand(sql, conn);
int x = comm.ExecuteNonQuery();
Session["selected"] = selected;
RadioButtonList1.SelectedIndex = -1;
Session["n"] = n;
display();
}
catch (Exception ex)
{
Label4.Visible = true;
Label4.Text = "Please Choose an answer "+ex.Message;
}
}
asmaa elbattanony
26-Jul-11 11:24am
View
Thank u for your reply
homework or not
I actually made an effort in this application
and i didn't ask to give me the full code
I'm having a problem in my code and I'm looking for help
Isn't this what this site is all about???
thank you again :)