How to allow paging in grid view control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaredciagar
    New Member
    • Feb 2008
    • 16

    How to allow paging in grid view control

    Hi Guys,
    Please Help ME....
    I have a problem in displaying data in my gridview with paging, the data from the database is displaying to my gridview but I want to allow paging in my gridview.how can I do that?
    I got an error msg that datareader does not allow paging in gridview....
    because I use datareader in binding my data.
    How can I convert my datareader to datatable using VB script so that I can allow paging to my Gridview?

    I'm Using ASP.net and MS SQL2005 and I'm using VB SCRIPT

    Here is my code:
    [code=vbnet]
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
    Dim con As New SqlConnection

    con.ConnectionS tring = "Integrated Security=True;d ata source=ph-erwinm1;" & "persist security info=false;Init ial Catalog=ITP"

    Const strSQL As String = "SELECT intITPCodePK,st rsubmitter,datR equested,datReq uired FROM tblITPtransacti on"
    Dim myCommand As New SqlCommand(strS QL, con)
    con.Open()
    GridITPSumm.Dat aSource = myCommand.Execu teReader(Comman dBehavior.Close Connection)
    GridITPSumm.Dat aBind()

    end sub



    ----------HTML-------------

    <asp:GridView id="GridITPSumm " runat="server" Width="606px" Height="18px" ForeColor="#333 333" AllowSorting="T rue" AllowPaging="fa lse" CellPadding="4" AutoGenerateCol umns="False" Font-Size="Smaller" Font-Overline="False " Font-Names="Arial" EnableViewState ="False" Font-Bold="False" style="left: 2px; position: relative; top: -33px">
    <FooterStyle BackColor="#507 CD1" ForeColor="Whit e" Font-Bold="True"></FooterStyle>
    <Columns>
    <asp:BoundFie ld DataField="intI TPCodePK" SortExpression= "intITPCode PK" HeaderText="ITP Code"></asp:BoundField>
    <asp:BoundFie ld DataField="strs ubmitter" SortExpression= "strsubmitt er" HeaderText="Sub mitter"></asp:BoundField>
    <asp:BoundFie ld DataField="datR equested" SortExpression= "datRequest ed" HeaderText="Dat e Requested"></asp:BoundField>
    <asp:BoundFie ld DataField="datR equired" SortExpression= "datRequire d" HeaderText="Dat e Required"></asp:BoundField>

    </Columns>

    <RowStyle BackColor="#EFF 3FB"></RowStyle>

    <EditRowStyle BackColor="#246 1BF"></EditRowStyle>

    <SelectedRowSty le BackColor="#D1D DF1" ForeColor="#333 333" Font-Bold="True"></SelectedRowStyl e>

    <PagerStyle BackColor="#246 1BF" ForeColor="Whit e" HorizontalAlign ="Center"></PagerStyle>

    <HeaderStyle BackColor="#507 CD1" ForeColor="Whit e" Font-Bold="True"></HeaderStyle>

    <AlternatingRow Style BackColor="Whit e"></AlternatingRowS tyle>
    </asp:GridView>[/code]




    Thank You Guys in Advance....
    Help Me Please....
    Last edited by jaredciagar; Feb 23 '08, 11:33 AM. Reason: Lack of Information
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Here is an example that may help:
    GridView

    Comment

    • jaredciagar
      New Member
      • Feb 2008
      • 16

      #3
      Originally posted by kenobewan
      Here is an example that may help:
      GridView
      Thank You for your effort but still my problem is not answered.
      I want to hard code it, I don't want to use wizard. My Problem is I'm using sqldatareader in binding data, many programmer said that you cannot edit or select or allow paging your gridview in using sqldatareader in binding data.
      what should I do? Is there other way in binding data to gridview control so that i can select or allow paging in may gridview control.

      thank you...
      please help

      Comment

      Working...