Hi,
I am testing a simple scenario with a GridView bound to a ObjectDataSource at desgin time - by using the DataSourceId attribute of GridView.
As soon as the page loads, it automatically triggers the Select method of the ObjectDataSource. Being a long query, it takes a while for the page to load. On other pages of the app, I have a button that triggers the Update Panel postback. I show a progress bar in the async request.
I do not want an unnecessary button click event to trigger the UpdatePanel async postback as there is no need of a button on this page.
And I do not want to manually bind the data source to the GridView.
How do I trigger the UpdatePanel async postback on the initial page load? Any ideas will be greatly appreciated.
Here's my code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" >
<ContentTemplate>
<div id="divGridView">
<asp:GridView ID="GridView1" SkinID="epwGridView" runat="server" DataSourceID="odsLocation">
<Columns>
<asp:BoundField HeaderText="Location" DataField="LOCATION_CODE" SortExpression="LOCATION_CODE" ItemStyle-Width="100"/>
<asp:BoundField HeaderText="Description" DataField="DESCRIPTION" SortExpression="DESCRIPTION" ItemStyle-Width="200" ReadOnly="true" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
</div>
<asp:ObjectDataSource ID="odsLocation" runat="server"
SelectMethod="GetLocations"
TypeName="EPWWEB.BLL.Maintenance.LocationBL" >
</asp:ObjectDataSource> Thanks
hpdotnet