Hi is it possible to fire pageindex changing event of a gridview with in a time interval?
Actually i tried with some code but it is showing page event args e not exist. How do i call this event in a timer tick in asp.net c# application?
thank you
Hi is it possible to fire pageindex changing event of a gridview with in a time interval?
Actually i tried with some code but it is showing page event args e not exist. How do i call this event in a timer tick in asp.net c# application?
thank you
ASPX Markup
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" PageSize="3">
</asp:GridView>
<asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick1">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
</form>
Code-Behind
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Data();
}
}
void Data()
{
DataTable dt = new DataTable();
dt.Columns.Add("No");
for (int i = 1; i <= 13; i++)
{
dt.Rows.Add(i.ToString());
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Timer1_Tick1(object sender, EventArgs e)
{
if (GridView1.PageCount == GridView1.PageIndex)
Timer1.Enabled = false;
GridView1.PageIndex++;
Data();
}