Click here to Skip to main content
15,903,203 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Showing an image in a column Pin
minhpc_bk3-Oct-06 10:59
minhpc_bk3-Oct-06 10:59 
QuestionOverride page constructor Pin
User 9148332-Oct-06 10:17
User 9148332-Oct-06 10:17 
AnswerRe: Override page constructor Pin
minhpc_bk2-Oct-06 15:42
minhpc_bk2-Oct-06 15:42 
GeneralRe: Override page constructor Pin
User 9148332-Oct-06 22:01
User 9148332-Oct-06 22:01 
GeneralRe: Override page constructor Pin
minhpc_bk2-Oct-06 22:17
minhpc_bk2-Oct-06 22:17 
GeneralRe: Override page constructor Pin
User 9148333-Oct-06 4:20
User 9148333-Oct-06 4:20 
GeneralRe: Override page constructor Pin
minhpc_bk3-Oct-06 10:56
minhpc_bk3-Oct-06 10:56 
GeneralRe: Override page constructor Pin
User 9148335-Oct-06 1:37
User 9148335-Oct-06 1:37 
Ok here it is.
this portion of code is in PageLoad:
<br />
          if(!IsPostBack)<br />
             {<br />
                    while (rd3.Read())<br />
                    {<br />
                        TableRow r1 = new TableRow();<br />
                        TableCell c1 = new TableCell();<br />
                        TableCell c2 = new TableCell();<br />
                        TableCell c3 = new TableCell();<br />
<br />
                        RadioButton rb = new RadioButton();<br />
                        rb.GroupName = "group_" + Session["questionID"];<br />
                        rb.ID = "Q_" + i + "_A_" + j;<br />
                        rb.Attributes.Add("dbID", rd3["AnswerID"].ToString());<br />
                        c1.Controls.Add(rb);<br />
                        j++;<br />
<br />
                        Label lbAnswer = new Label();<br />
                        lbAnswer.Text = rd3["Text"].ToString();<br />
<br />
<br />
                        c2.Controls.Add(lbAnswer);<br />
<br />
                        if (rd3["AnswerPicture"] != null)<br />
                        {<br />
                            Image im = new Image();<br />
                            im.ImageUrl = rd3["AnswerPicture"].ToString();<br />
                            if (im.ImageUrl.Length > 3)<br />
                                c3.Controls.Add(im);<br />
                        }<br />
<br />
<br />
                        r1.Cells.Add(c1);<br />
                        r1.Cells.Add(c2);<br />
                        r1.Cells.Add(c3);<br />
<br />
                        tblQuestions.Rows.Add(r1);<br />
<br />
                    }<br />
<br />
                } //  if (!(currQuestion.Contains(questID)))<br />
                else<br />
                    i -= 1;<br />
                newPage = false;<br />
            } // for (int i = 0; i < CountQuestion; i++)<br />
      }<br />

and this method is called in event handler for the "Next" button
<br />
private void CheckAnswers()<br />
    {<br />
        Response.Write(Session["areaID"]);<br />
        Int32 i = 0;<br />
        while (true)<br />
        {<br />
<br />
<br />
            Label lbl = (Label) tblQuestions.Rows[i].Cells[1].FindControl("Q_" + i);<br />
<br />
            if (lbl == null)<br />
            {<br />
                break;<br />
            }<br />
<br />
            Int32 j = 0;<br />
            while (true)<br />
            {<br />
                RadioButton rb = (RadioButton) tblQuestions.Rows[i].Cells[0].FindControl("Q_" + i + "_A_" + j);               <br />
   <br />
                if (rb == null)<br />
                {<br />
                    break;<br />
                }<br />
<br />
                if (rb.Checked)<br />
                {<br />
<br />
                    if (isCorrect(lbl.Attributes["dbID"], rb.Attributes["dbID"]))<br />
                    {<br />
                        Int32 pts = Convert.ToInt32(Session["points"].ToString()) + Convert.ToInt32(lbl.Attributes["pts"]);<br />
                        Session["points"] = pts;<br />
                    }<br />
                }<br />
                <br />
                j++;<br />
<br />
            }<br />
            i++;<br />
<br />
        }<br />
    }<br />

but it finds no radio buttons Frown | :(

What I need is to load questions from the database, put them on the page and when user klicks "next" to read which radio buttons user clicked and calculate the points.


--Nikola--


modified 7-Dec-20 21:01pm.

GeneralRe: Override page constructor Pin
minhpc_bk5-Oct-06 14:54
minhpc_bk5-Oct-06 14:54 
GeneralRe: Override page constructor Pin
User 9148336-Oct-06 1:50
User 9148336-Oct-06 1:50 
GeneralRe: Override page constructor Pin
minhpc_bk9-Oct-06 18:12
minhpc_bk9-Oct-06 18:12 
Questiondatagrid NumericPages mix up Pin
keroed_edmond2-Oct-06 10:00
keroed_edmond2-Oct-06 10:00 
AnswerRe: datagrid NumericPages mix up Pin
minhpc_bk2-Oct-06 15:44
minhpc_bk2-Oct-06 15:44 
QuestionRetain CSS format reading a Page Pin
VickyC#2-Oct-06 9:20
VickyC#2-Oct-06 9:20 
AnswerRe: Retain CSS format reading a Page Pin
Guffa2-Oct-06 10:11
Guffa2-Oct-06 10:11 
GeneralRe: Retain CSS format reading a Page Pin
VickyC#2-Oct-06 10:55
VickyC#2-Oct-06 10:55 
AnswerRe: Retain CSS format reading a Page Pin
Guffa2-Oct-06 21:43
Guffa2-Oct-06 21:43 
QuestionConfirm User Registration Pin
TheEagle2-Oct-06 9:10
TheEagle2-Oct-06 9:10 
AnswerRe: Confirm User Registration Pin
morteza572-Oct-06 12:05
morteza572-Oct-06 12:05 
GeneralRe: Confirm User Registration Pin
TheEagle3-Oct-06 9:51
TheEagle3-Oct-06 9:51 
QuestionAsp help Pin
Larsson2-Oct-06 6:31
Larsson2-Oct-06 6:31 
AnswerRe: Asp help Pin
minhpc_bk2-Oct-06 15:53
minhpc_bk2-Oct-06 15:53 
QuestionLooking for XML Web services Pin
Sudhakar Pasupunuri2-Oct-06 6:03
Sudhakar Pasupunuri2-Oct-06 6:03 
AnswerRe: Looking for XML Web services Pin
minhpc_bk2-Oct-06 16:02
minhpc_bk2-Oct-06 16:02 
AnswerRe: Looking for XML Web services Pin
Exelioindia2-Oct-06 22:56
Exelioindia2-Oct-06 22:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.