I have table and button ,I want to increment that table with click of button,How can i achieve this?
My Table is Similar to this
<table>
<tr>
<td colspan="2">
Information
</td></tr>
<tr>
<td>
city
</td>
<td>
<asp:TextBox ID="tCity" runat="server">
</asp:TextBox>
</td></tr>
<tr>
<td>
state
</td>
<td>
<asp:TextBox ID="tState" runat="server">
</asp:TextBox>
</td></tr>
<tr>
<td>
zip
</td>
<td>
<asp:TextBox ID="tZip" runat="server">
</asp:TextBox>
</td></tr></table>
<asp:LinkButton ID="AddNew" runat="server" />
Example
Information
City ---------
State ---------
Zip ---------
Add New Button
After Click on Button I want
Information
City ---------
State ---------
Zip ---------
Information
City ----------
State ---------
Zip ---------
Add New Button
I try with Gridview But I don't know logic and I also Google this But Dont find anything. +
What you want to do sounds easy in theory, but it isn't that easy in practice. You have to create controls dynamically in your button click event, add them to the page, and recreate them OnInit to get the viewstate bound to them.
You should read about dynamic controls in ASP.NET: https://web.archive.org/web/20211031102347/https://aspnet.4guysfromrolla.com/articles/092904-1.aspx
Good luck!