" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi

Dynamically Adding/Deleting Rows To Table

Posted on November 23rd, 2015 by Chandrabhanu Mishra

We can add/delete rows to asp.net table component dynamically with preservation of input data. AddNewRow.aspx Page: <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”AddNewRow.aspx.cs” Inherits=”AddNewRow” %> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> <title></title> <script type=”text/javascript”> function LinkButtonClick(lbID) { var ind = lbID.split(“Row_”)[1]; ind = ind.split(“Col_”)[0]; document.getElementById(“<%= HiddenField1.ClientID%>”).value = ind; document.getElementById(“<%= btnRemove.ClientID%>”).click(); } […]