paging

Discussion in 'ASP .Net Datagrid Control' started by avital, Dec 30, 2003.

  1. avital

    avital Guest

    Hi,

    Can someone please help me?
    I am trying to add paging to my datagrid but it isn't working. I thought that the arrows should at least appear as a link (<>) but it doesn't. it appears as <> without a link.

    Thanks in advance
    aspx.vb




    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    'Put user code to initialize the page here

    Dim isAuth As Boolean = False

    Try

    ad_id = CLng(Request.QueryString("ad_id"))

    cat_id = Request.QueryString("cat_id")

    sub_id = Request.QueryString("sub_id")

    sid = Session.Item("sid")

    UD = (US.GetUserDataByGuid(sid))

    Catch

    Response.Redirect("default.asp")

    End Try

    If Not UD.IsAdmin Then

    isAuth = False

    Response.Redirect("default.asp")

    End If

    AD_ApprovedState = Request.QueryString("aprst")

    fillTable()

    End Sub

    Public Sub fillTable()


    AD_ApprovedState = "1"

    If AD_ApprovedState = "" Then

    AD_ApprovedState = "0"

    End If

    cmd = oConn.CreateCommand

    cmd.CommandText = "select *, 'adDetail.aspx?sid=' + @sid + '&ad_id=' + CAST(ad_id AS NVARCHAR(16))+ '&sub_id=' + CAST(sub_id AS NVARCHAR(16))+ '&cat_id=' + CAST(cat_id AS NVARCHAR(16)) AS url_str FROM ybay_mdb...ads where ad_approved=@AD_ApprovedState"

    cmd.Parameters.Add("@sid", sid)

    cmd.Parameters.Add("@AD_ApprovedState", AD_ApprovedState)

    oConn.Open()

    Dim DR As SqlDataReader

    DR = cmd.ExecuteReader


    DataGrid1.DataSource = DR

    DataGrid1.DataBind()

    DR.Close()

    oConn.Close()

    End Sub

    Sub doPaging(ByVal s As Object, ByVal e As DataGridPageChangedEventArgs)

    DataGrid1.CurrentPageIndex = e.NewPageIndex

    fillTable()

    DataGrid1.DataBind()

    End Sub

    End Class



    aspx:

    <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False" GridLines="Horizontal"
    CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="None" BorderColor="#E7E7FF"
    OnPageIndexChanged="doPaging" PagerStyle-HorizontalAlign="Center" PageSize="5" AllowPaging="True"
    AllowCustomPaging="True"><SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle><AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle><ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle><HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle><FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle><Columns><asp:BoundColumn DataField="ad_poster" HeaderText="Owner"></asp:BoundColumn><asp:BoundColumn DataField="ad_expired" HeaderText="Date Expired"></asp:BoundColumn><asp:BoundColumn DataField="ad_dated" HeaderText="Date"></asp:BoundColumn><asp:BoundColumn DataField="ad_man" HeaderText="Manager"></asp:BoundColumn><asp:BoundColumn DataField="ad_quantity" HeaderText="Quantity"></asp:BoundColumn><asp:BoundColumn DataField="ad_id" HeaderText="AD_ID"></asp:BoundColumn><asp:HyperLinkColumn Text="ad_title" Target="_self" DataNavigateUrlField="url_str" DataTextField="ad_title"
    HeaderText="Title"></asp:HyperLinkColumn></Columns><PagerStyle VerticalAlign="Middle" HorizontalAlign="Center" ForeColor="#4A3C8C" BackColor="#E7E7FF"></PagerStyle></asp:datagrid>
     
    avital, Dec 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Yangtsi River

    using Paging in Datagrid

    Yangtsi River, Jul 9, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    352
    Benjie Fallar
    Jul 9, 2003
  2. Saravana

    Re: Custom paging

    Saravana, Jul 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    426
    Saravana
    Jul 10, 2003
  3. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,776
    Scott Allen
    Oct 8, 2004
  4. wh1974
    Replies:
    0
    Views:
    2,452
    wh1974
    Jan 12, 2005
  5. Red
    Replies:
    1
    Views:
    733
Loading...

Share This Page