Reputation: 1733
I am creating a gridview in a web form application. I have provided the link below for reference. In this gridview, I have textboxes in each row and when I click save, it can save the data to database. However, the gridview itself still have the textboxes in each row after I click saved. My question is how can I not show the textboxes when I click the save button but instead only show the text that I have entered in each row? Help will be appreciated.
Here is the link that I use for my gridview
Upvotes: 0
Views: 705
Reputation: 333
In the markup of your page add a label to each itemtemplate column and set the visible property to false, like this:
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Visible="true"></asp:TextBox>
<asp:Label ID="Label1" runat="server" Visible="false"></asp:Label>
</ItemTemplate>
Then use FindControl like you are doing with the textboxes and set visible for the textboxes to false and visible for the labels to true in the click event of the Save button.
Upvotes: 1
Reputation: 635
Use this Example below,for gridview CRUD opeartion with Editable textbox in columns,
Upvotes: 1