adnan

adnan

  • NA
  • 2
  • 0

how to add paging in table webcontrol in web form

May 14 2009 2:33 PM

hi, i'm population a table control from dataset at runtime with each record being added in new row of the table. i want to enable paging if the rows of table increase from 10.

the code  i'm using for population table is given below..... kindly if anyone can help me in this matter... thnx in advance =)

 

Protected Sub Populate_Table()

       Dim survey_id As Integer
        survey_id = 2

        Dim QAdapter As New Q_optTableAdapters.QuestionTableAdapter
        Dim OptAdapter As New Q_optTableAdapters.OptionsTableAdapter

        Dim QList As Q_opt.QuestionDataTable
        Dim OptList As Q_opt.OptionsDataTable

        QList = QAdapter.GetData
        OptList = OptAdapter.GetData


        For Each Question As Q_opt.QuestionRow In QList
            If Question.Survey_ID = survey_id Then              

                Dim rownew As New TableRow
                Tb1.Rows.Add(rownew)
                Dim cellNew As New TableCell()
             
                If Question.Question_Type = "Single Selection" Then
                    Dim radio As New System.Web.UI.WebControls.RadioButtonList
                    cellNew.Controls.Add(radio)
                    For Each options As Q_opt.OptionsRow In OptList
                        If Question.Question_Id = options.Question_Id Then
                            radio.Items.Add(options.opt_text)
                        End If
                    Next
              
               Else  If Question.Question_Type = "Multiple Selection" Then
                    Dim checkbox1 As New System.Web.UI.WebControls.CheckBoxList
                    cellNew.Controls.Add(checkbox1)
                    For Each options As Q_opt.OptionsRow In OptList
                        If Question.Question_Id = options.Question_Id Then
                            checkbox1.Items.Add(options.opt_text)
                        End If
                    Next
                End If         
            End If
        Next
    End Sub