Here I Will Explain How to create a simple Online Examination Form by using c# in Asp.Net
{
HttpCookie obj = new HttpCookie("Q1");
if (RadioButton1.Checked
== true)
obj.Value = "y";
else
obj.Value = "N";
Response.Cookies.Add(obj);
Response.Redirect("page2.aspx");
}
protected void Button1_Click(object sender, EventArgs
e)
{
HttpCookie obj = new HttpCookie("Q2");
if (RadioButton1.Checked
== true)
obj.Value = "y";
else
obj.Value = "N";
Response.Cookies.Add(obj);
Response.Redirect("page3.aspx");
}
protected void Button1_Click(object sender, EventArgs
e)
{
HttpCookie obj = new HttpCookie("Q3");
if (RadioButton1.Checked
== true)
obj.Value = "y";
else
obj.Value = "N";
Response.Cookies.Add(obj);
Response.Redirect("result.aspx");
}
protected void Page_Load(object sender, EventArgs
e)
{
HttpCookie obj;
int total = 0;
string s = "";
for (int i = 0;
i<Request.Cookies.Count; i++)
{
obj = Request.Cookies[i];
s = s + "Q" + (i + 1)
+ " " + obj.Value+"<br>";
if (obj.Value ==
"y")
{
total = total
+ 1;
}
if (total < 2)
{
Label1.Text =
"Result is" + "<br>" + s +
"correct answer" + total
+ "youfailed";
}
else
{
Label1.Text =
"Result is" + "<br>" + s +
"correct answers are" +
total + "youpassed";
}
}
}
0 comments::
Post a Comment