Archive | ASP RSS feed for this section

Dynamically adding table row using JQuery

30 Aug

Here is the code for adding rows dynamically  into a HTML table using JQuery. If you want to insert rows to a HTML table in your asp page this is helpful. Using the following code you can insert  a new row at client side without postbacking.

$(‘ tblDoc tr:last’).after(

“<tr>”+“<td  style=’width:150px;’><span>” + getTextBoxValue(‘<%=txtDocName.ClientID %>’) + “</span></td><td  style=’width: 150px’>” + getTextBoxValue(<%=txtDocNo.ClientID %>’) + “</td><td  style=’width: 150px’>” + getTextBoxValue(‘<%=txtIssuedBy.ClientID %>) + “</td><td  style=’width: 150px’>” + getTextBoxValue(‘<%=txtIssuedDate.ClientID %>’) + “</td><td  style=’width: 150px’>” + getTextBoxValue(‘<%=txtRenewalDate.ClientID %>’) + “</td></tr>”

);

tblDOC– Name of the table

Values are inserted at last row.