Most of the time we came across need to get HTML render string for any control. .Net provides a support for this, but is a bit complicated. This function is very helpful when working with AJAX or ICallback event handler
So no worries friends, here is a sample code that will help all of us to get RederHTML string of any control.
private string RenderControlToString(Control c)
{
StringBuilder sb = new StringBuilder();
System.IO.StringWriter sw = new System.IO.StringWriter(sb);
HtmlTextWriter htmlWriter = new HtmlTextWriter(sw);
c.RenderControl(htmlWriter);
c.Dispose();
sw.Close();
return sb.ToString();
}
call this function wherever required.... cheers
Tuesday, May 13, 2008
Subscribe to:
Post Comments (Atom)
4 comments:
SURJIT BI JI ,I NEED UR CELL NO AND EMAIL ID,I WANT SOME KNOWLEDGE IN ASP.NET
MY QUERY IS:
PROBLEM: IN A .aspx FILE I TOOK A TEXTBOX CONTROL AND MADE IT MULTILINED USING ITS PROPERTY MODE,I MADE THIS PAGE LINKED WITH MASTER PAGE,
BUT PROBLEM IS THAT I WANT USER TO RESTRICT UPTO 50 CHARACTER IN THAT MULTILINED TEXTBOX,how to do so.
2....
i m using sql server 2005 ,i want chinese people could also enter data in my database,(what changes should i make for it in database)and there should be chinese language by default on my website when they access it,and when indian access it,it should be english.how to do such task,plz guide me
Hi Sumit,
Use the following link to resolve your problem.
http://www.codeproject.com/KB/webforms/MultilineLength.aspx
Thanks
Surjit
SURJIT JI,
I HAVE UNDERTAKEN A PROJECT(WEBSITE),BUT I M SURE THAT I CAN'T MAKE IT UPTO COMPLETE,IF U KEEP GOOD KNOWLEDGE IN .NET,THEN MY PROJECT WOULD TAKE YOUR 4 HOURS AND YOU WILL EARN 4000 RS. IN 4 HOURS.(YOU MUST HAVE EFFICIENT KNOWLEDGE IN GLOBALISATION IN ASP.NET),IF U R UNABLE,THEN U MAY TELL ME ANY EXPERT CONTACT WHO IS EXPERT IN GLOBAL WEBSITES.
SUMIT KUMAR
09813709367
Post a Comment