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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s