Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
In a gridview, i binded the datum from database in labels...In tat grid, i have to add multiple no.of rows which should contain only textbox , so tat i can enter some values in the grid...

I should not use footer template....So Existing rows should be displayed in labels and i should not get any chances of editing the existing datas in the grid....only thing is i need to insert 'n' number of rows which should contain only textbox not the labels...can anyone suggest me some solution for this????
Posted

You can use Labels inside the EditTemplate and ItemTemplate.

This is family easy to do.

XML
<asp:TemplateField HeaderText="Column1">
<EditItemTemplate>
<asp:Label ID="1" runat="server" Text='<%# Bind("columntext") %>'> </asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("columntext") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>


The above code sample should help you out.
 
Share this answer
 
also u use get the data from db layer through business layer. then bind the datasource to based on below..

below code bizLyer.Select() is used for retrieve the data from db.
then we will bind the data to grid.

gvData.DataSource = bizLayer.Select();
gvData.DataBind();
 
Share this answer
 
v2
 
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