1
Answer

How to get all the records in gridview after paging

nagaraju

nagaraju

13y
1.9k
1

Hi,

I am having 50 questions in gridview. now i am dispalying 5 questions per page.
now i want to retrieve the user selected answers . but with gridview rows event i can able to access only current page questions. but i want all the questions in all pages. how can i achieve this .

foreach (GridViewRow gvrow in GV_Questionpaper.Rows)
        {
            RadioButton Option1 = (RadioButton)gvrow.FindControl("RBtn_Option1");
            RadioButton Option2 = (RadioButton)gvrow.FindControl("RBtn_Option2");
            RadioButton Option3 = (RadioButton)gvrow.FindControl("RBtn_Option3");
            RadioButton Option4 = (RadioButton)gvrow.FindControl("RBtn_Option4");
            if (Option1.Checked)
            {
                answer[i] = Option1.Text;
                i++;
            }
            else if (Option2.Checked)
            {
                answer[i] = Option1.Text;
                i++;
            }
            else if (Option3.Checked)
            {
                answer[i] = Option1.Text;
                i++;
            }
            else if (Option4.Checked)
            {
                answer[i] = Option1.Text;
                i++;
            }
            else
            {
                answer[i] = "Unanswered";
                i++;
                unanswered++;
            }
        }
        foreach (string str in answer)
        {
            Response.Write(str+"\n");
        }

Thanks&Regards
P.Nagaraju

Answers (1)