none
autochange page index in gridview asp.net RRS feed

  • Question

  • i have one wallboard application in which i have to display some record in a gridview. as number of records are large in numbers so i have to implement paging in gridview. but as it is wallboard application user cannot change the page. so after each 10 seconds i have to show the next page. 

    CS Code:

    protected void Timer1_Tick1(object sender, EventArgs e)
        {
            if (GV_ExtCallSummary.PageCount == GV_ExtCallSummary.PageIndex)
            {
            //    timer1.Enabled = false;
            //    GV_ExtCallSummary.PageIndex = 1;
    
            }
            else
            {
                try
                {
                  //  GV_ExtCallSummary.PageIndex++;
                    GV_ExtCallSummary.SetPageIndex(1);
                  //  GV_ExtCallSummary.DataSource = dt;
                    GV_ExtCallSummary.DataBind(); 
                }
                catch(Exception ex)
                {
                    string exv = ex.Message;
                }
            }
        }

    above is the code which i tried with ticker.

    if i try to use GV_ExtCallSummary.PageIndex++ nothing happens. just increase in pageindex.

    and if i use setpageindex(1) it throws exception that "The GridView 'GV_ExtCallSummary' fired event PageIndexChanging which wasn't handled."

    even thought the function do exist.

    protected void GV_ExtCallSummary_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GV_ExtCallSummary.PageIndex = e.NewPageIndex;
            GV_ExtCallSummary.DataSource = dt;
            GV_ExtCallSummary.DataBind();
    
        }

    and this function works fine if i click on page numbers.

    HTML if any one wants to see html code

    <asp:GridView ID="GV_ExtCallSummary" runat="server" AutoGenerateColumns="false" 
    Width="100%" Visible="true" OnRowDataBound="GV_ExtCallSummary_RowDataBound"  OnPageIndexChanging="GV_ExtCallSummary_PageIndexChanging"
    EmptyDataText="No data exist." AllowPaging="True" CssClass="table" HeaderStyle-BackColor="#669999" 
    AlternatingRowStyle-CssClass="success" PageSize="10">
    <Columns> 
        <asp:TemplateField HeaderText="Extention">
            <ItemTemplate>
                <asp:Label ID="lblExt" runat="server" Text='<%# Bind("Extension") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    
        <asp:TemplateField HeaderText="Name">
            <ItemTemplate>
                <asp:Label ID="lblExtName" runat="server" Text='<%# Bind("ExtnName") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    
        <asp:TemplateField HeaderText="Abandon">
            <ItemTemplate>
                <asp:Label ID="lblAdandon" runat="server" Text='<%# Bind("Abandon") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    
        <asp:TemplateField HeaderText="Incoming">
            <ItemTemplate>
                <asp:Label ID="lblIncoming" runat="server" Text='<%# Bind("Incoming") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    
        <asp:TemplateField HeaderText="Outgoing">
            <ItemTemplate>
                <asp:Label ID="lblOutgoing" runat="server" Text='<%# Bind("Outgoing") %>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Intercom">
            <ItemTemplate >
                <asp:Label ID="lbl_Intercom" runat="server" Text='<%# Bind("Intercom") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <SelectedRowStyle BackColor="#8AC5FF" Font-Bold="True" ForeColor="White" />

    Can anyone help? i will be very thankful. thanks.


    • Moved by CoolDadTx Thursday, July 13, 2017 1:54 PM ASP.NET related
    Thursday, July 13, 2017 9:15 AM

All replies

  • Can anyone help? i will be very thankful. thanks.

    Correct forum you have posted to?

    http://forums.asp.net/

    Thursday, July 13, 2017 11:00 AM