ASP.NET Page /Question.aspx.cs (C#)
1: using System;  
2: using System.Data;  
3: using System.Web.UI;  
4: using System.Web.UI.WebControls;  
5: using QuizNetOnline.Logic;  
6: using System.Drawing;  
7: using QuiznetOnline.Web.UI.BusinessClasses;  
8: using Microsoft.ApplicationBlocks.Data;  
9:   
10: public partial class _Question : QuiznetOnline.Web.UI.BusinessClasses.BasePage  
11: {  
12:     Question question = new Question();  
13:     int QuestionID = 0;  
14:   
15:     protected override void Page_Load(object sender, EventArgs e)  
16:     {  
17:         int fieldLabel=1;  
18:         if (!Page.IsPostBack)  
19:         {  
20:             base.Page_Load(sender, e);  
21:   
22:             if (Request.QueryString["QuestionID"] == null)  
23:                 return;  
24:   
25:             if (((UserWeb)Session["userWeb"]).UserName == "??????????????????????")  
26:                 QuestionID = Convert.ToInt32(Request.QueryString["QuestionID"].ToString());  
27:             else  
28:                 QuestionID = Convert.ToInt32(Crypto.Decrypt(Request.QueryString["QuestionID"].ToString(),new Crypto()));  
29:   
30:             question.LoadQuestion(QuestionID,new SqlWrapper());  
31:   
32:   
33:             if (question.QuestionId == 0)  
34:             {  
35:                 lblQuestion.Text = "Question does not exist";  
36:                 return;  
37:             }  
38:   
39:             lblQuestion.Text = question.QuestionDesc;  
40:             lblExplaination.Text = question.Explaination;  
41:   
42:             if (!string.IsNullOrEmpty(question.Link))  
43:             {  
44:                 hypLink.NavigateUrl = question.Link;  
45:                 hypLink.Text = "External Explaination";  
46:             }  
47:   
48:               
49:   
50:             lblAnswer.Text = question.AnswerDesc;  
51:   
52:             lblCorrect.Text = question.Correct.ToString();  
53:             lblIncorrect.Text = question.Incorrect.ToString();  
54:   
55:             foreach (Answer ans in question.Answers)  
56:             {  
57:                 Label lbl = (Label)FormOperations.FindControlRecursive(Page, "lblAnswer" + fieldLabel.ToString());//Page.FindControl("lblAnswer" + fieldLabel.ToString());  
58:                 lbl.Text = ans.AnswerDesc;  
59:                 fieldLabel++;  
60:             }  
61:         }  
62:     }  
63:   
64:   
65: }  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.