Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can bind data to under Gridview :



XML
<asp:GridView id="gridUserData" runat="server" >
    <Columns>
        <asp:TemplateField HeaderText="User Code" HeaderStyle-Width="110px" SortExpression="USRM_USER_CD"  >
            <ItemTemplate>
                <asp:Label ID="lblRepUserCode" runat="server" Text='<%#Eval("USRM_USER_CD")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="User Name" SortExpression="USRM_USER_NAME" HeaderStyle-Width="150px">
            <ItemTemplate>
                <asp:Label ID="lblRepUserName" runat="server" Text='<%#Eval("USRM_USER_NAME")%>' />
            </ItemTemplate>
        </asp:TemplateField>
  </Columns>
</asp:GridView>
Posted
Comments
DamithSL 17-Nov-14 11:35am    
why? you can easily do it using serveside code like c# or vb.net

1 solution

Have a look at the GridView.DataBind()[^] method, that would let you bind data, and you can assign a dynamic data from Database to it through a simple SQL Query that would return the records from your database.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900