ASP.NET - problem when refreshing hole page using timer controll

Asked By mani on 15-Jun-12 12:55 AM
hi..i have gridview and two dropdownlist  for searching and show record in gridview also..and also i am refreshing gridview using time controll its refreshing hole page at certian time interval..but i am not able to search properly because dropdownlist focus is not focusing correctly by refreshing hole page..

i used updated panel for gridview to update only gridview ..but not paging is not working....any solutions??appreciated..
Jitendra Faye replied to mani on 15-Jun-12 01:02 AM
Yes, if you are refreshing the page then Paging will be lost because every time fresh data will be loaded to grid,

here you can do one thing- You can maintain Paging index in ViewState Variable, and after loding grid assign pageIndex to GridView.

Like this-

In paging-

protected void GridEmpData_PageIndexChanging(object sender, GridViewPageEventArgs e)
      ViewState["index"]= e.NewPageIndex;


Now After loading Grid use this code-

gdUsers.PageIndex =Convert.ToInt32(ViewState["index"]);

Try this and let me know.
dipa ahuja replied to mani on 15-Jun-12 04:49 AM
Use updatePanel <script type="text/javascript" language="javascript">
   function delayUpdateClick(sender, args) {
     button = $get("<%= buttonUpdate.ClientID %>");
     setTimeout(function () {; }, 5000);
<cc1:UpdatePanel ID="updateGrid" runat="server" UpdateMode="Conditional">
     <asp:GridView ID="GridVie1" runat="server">
<asp:Button ID="buttonUpdate" runat="server" Style="display: none" OnClick="buttonUpdate_Click" />