Get innerHtml of html table in server side

Posted by S_tarai under ASP.NET on 1/20/2012 | Points: 10 | Views : 15388 | Status : [Member] | Replies : 3
I have a html table in my default.aspx file with ruat server.

but i want to get the innerHtml of this table and user it any where with server side

Just my page codes like this
<table id="demo" runat="server" style="width:100%;">
..............
.......................
</table>


and server side

HtmlTable cont = (HtmlTable)this.FindControl("demo");
string tablevalue = cont.InnerHtml;




but here error is showing me
'HtmlTable' does not support the InnerHtml property.

Thanks
Surendra Tarai
tarai.surendra16@gmail.com



Responses

Posted by: Blessyjees on: 1/23/2012 [Member] Bronze | Points: 25

Up
0
Down
hi,

we are not able to use innerhtml and innertext for htmltable. you can try this with div.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

S_tarai, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hemanthlaxmi on: 1/23/2012 [Member] Starter | Points: 25

Up
0
Down
See when you have given the attribute "runat".You can directly access the Table in the Server Side also.

Check this

protected void Page_Load(object sender, EventArgs e)

   
{

       
if (!Page.IsPostBack)

       
{

           
string innerHtml = demo.InnerHtml;

       
}

   
}


See here i am accessing the HTML Table Directly.

Try this if any issues revert me the issue.

If this helps you .
Please "Mark as Answer"

S_tarai, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Susanthampy on: 1/24/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Refer this,

http://stackoverflow.com/questions/3451470/asp-net-get-table-html

Regards,
Susan

S_tarai, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response