Microsoft
Software
Hardware
Network
Question : asp.net - gridview populates/refreshes on page load in
is there a way to populate a gridview on page load...I am using code similar to below from ms link...its all in the control..not in code behind..
<asp:GridView ID="GridView1" AllowSorting="true" AllowPaging="true" Runat="server"
DataSourceID="SqlDataSourc
e1" AutoGenerateEditButton="tr
ue" DataKeyNames="au_id"
AutoGenerateColumns="False
">
<Columns>
<asp:BoundField ReadOnly="true" HeaderText="ID" DataField="au_id" SortExpression="au_id" />
<asp:BoundField HeaderText="Last Name" DataField="au_lname" SortExpression="au_lname" />
<asp:BoundField HeaderText="First Name" DataField="au_fname" SortExpression="au_fname" />
<asp:BoundField HeaderText="Phone" DataField="phone" SortExpression="phone" />
<asp:BoundField HeaderText="Address" DataField="address" SortExpression="address" />
<asp:BoundField HeaderText="City" DataField="city" SortExpression="city" />
<asp:BoundField HeaderText="State" DataField="state" SortExpression="state" />
<asp:BoundField HeaderText="Zip Code" DataField="zip" SortExpression="zip" />
<asp:CheckBoxField HeaderText="Contract" SortExpression="contract" DataField="contract" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT [au_id], [au_lname], [au_fname], [phone], [address], [city], [state], [zip], [contract] FROM [authors]"
UpdateCommand="UPDATE [authors] SET [au_lname] = @au_lname, [au_fname] = @au_fname, [phone] = @phone, [address] = @address, [city] = @city, [state] = @state, [zip] = @zip, [contract] = @contract WHERE [au_id] = @au_id"
ConnectionString="<%$ ConnectionStrings:Pubs %>" />
Answer : asp.net - gridview populates/refreshes on page load in
As far as I know, it should.
Arun
Random Solutions
transfering a directory with multiple files in parallel
Exchange 2010. Install Failed, now can't uninstall
Change Username on SBS2008
My laptop hp pavilion dv9000 suddenly doesnt start
Raid 1 Rebuild Failed - Adaptec 1210SA
DNS Server 2008 SBS errors
Delphi & TWebBrowser issue ???
switching networks on a cicso asa5510
How to set a MySql root user password that has not been set
Windows XP BSOD 0x000000f4 (0x00000003, 0x86e69b50, 0x86e69cc4, 0x805fb146)