tags:

views:

33

answers:

3

I am generating a dynamic HTML table string and displaying inside a div. I am assigning ID and runat server in that string. eg.

string s="<table id='tblAll' runat='server'></table>".

This string is generated on some different page, and its passed as XmlhttpResponseText

I want to apply sorting on this table, It would be great if any one can help me out. Thanks

+2  A: 

You can use jQuery tablesorter plugin

rahul
ya but how?? i can not assign the id, as its in string$("#HTMLTableName").tablesorter();its not able to find that HTML Table ID
Mahesh Varia
After inserting the object to the DOM you can bind it. I am not sure whether tablesorter will work for dynamically generated objects.
rahul
A: 

ya but how?? i can not assign the id, as its in string

$("#HTMLTableName").tablesorter();

its not able to find that HTML Table ID

Mahesh Varia
A: 

Use the jQuery tablesorter plugin, and instead of selecting the table via it's Id, you can select it via the containing div and a child selector:

$("div#container table").tablesorter();
Tom