Monday, June 16, 2008

Solution of "Cannot get inner content of your DIV because the contents are not literal. "

if you want to send your div inner htnl as a string and you are finding error "Cannot get inner content of DIV because the contents are not literal."

Solution is :-

StringWriter sw = new StringWriter();
HtmlTextWriter h= new HtmlTextWriter(sw);
objDiv.RenderControl(h);
string str= sw.GetStringBuilder().ToString();


* objDiv is your DIV Id.

Thanks

7 comments:

Hari Ravula said...

Great Solution!
Thanks-

Ayman Mabrouk said...

Thanks a lot

Vinoth Kumar Pagandai said...

Hi

I am unable to get my DIV id as it's placed under a TemplateField.

I am trying to get the DIV id in onRowDatabound.

please advise on this.

Thanks
Vinoth

Anandhan Rajaraman said...

Thanks bro....

sreekanthkr said...

Good work

Unknown said...

Every great and deep difficulty bears in itself its own solution. It forces us to change our thinking in order to find it. See the link below for more info.


#solution
www.ufgop.org

Unknown said...

thanks... works!!