Hi,
I have to refresh automatically a GridView. I use an UpdatePanel control and a Timer control.
This is my HTML code:
<asp:Timer ID="TMROrdiniInviati" runat="server" Interval="15000"></asp:Timer><asp:UpdatePanel ID="UPOrdiniInviati" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional" ViewStateMode="Enabled"><ContentTemplate> <asp:GridView ID="GVOrdiniCorriereMG" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3"
DataSourceID="SDSOrdiniCorriereMG"
DataKeyNames="IDOrdine" HorizontalAlign="Center"
EmptyDataText="Nessun ordine inviato presente in archivio" Width="95%">
........................
........................
........................</asp:GridView><asp:SqlDataSource ID="SDSOrdiniCorriereMG" runat="server" ConnectionString="<%$ ConnectionStrings:AHR_PORTALE_sa_ConnectionString %>"
........................
........................
........................ </asp:SqlDataSource></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="TMROrdiniInviati" EventName="Tick" /> </Triggers></asp:UpdatePanel>And this is my code-behind code:
Private Sub TMROrdiniInviati_Tick1(sender As Object, e As System.EventArgs) Handles TMROrdiniInviati.Tick
GVOrdiniCorriereMG.DataBind()
End SubThe GridView auto-refresh works fine every 15 seconds but I have a problem when I select a GridView row by clicking on a select column.
When I click to select a GridView row, the SelectedIndexChanged event is raised when the next Timer tick event occours... so I have to wait 15 second before the selection action is executed.
I have to refresh automatically the GridView but I have, also, to work with GridView rows normally...
Thank you very much!