Here is one sample code that explains how to use the DynamicField class inside a Gridview Follow the steps to add dynamic behavior to a GridView
And set the DataField property of the DynamicField control to the name of the data column or row that you want to bind to.
ASPX: <asp:GridView ID="GridView1"
runat="server" DataSourceID="GridDataSource"
EnablePersistedSelection="True" AutoGenerateColumns="False" GridLines="None" AllowPaging="True" AllowSorting="True" >
<Columns> <asp:DynamicField DataField="ProductID" HeaderText="Product ID" /> <asp:DynamicField DataField="ProductName" HeaderText="Product Name" /> <asp:DynamicField DataField="Description" HeaderText="Description" /> <asp:DynamicField DataField="ModifiedDate" HeaderText="Modified Date" /> </Columns>
<PagerTemplate> <asp:GridViewPager runat="server" /> </PagerTemplate> <EmptyDataTemplate> There are currently no items in this table. </EmptyDataTemplate> </asp:GridView>
Shinu
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: