Popular Posts

Wednesday, 6 July 2011

Gridview to HTML in ASP.Net

Suppose you have a gridview with data and want to convert in HTML so that it can be accessible in form`s HTML Control like div1.InnerHtml.


Namespace Used :

using System.Text;

using System.IO;


Code:
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(sw);
gv.RenderControl(hw);
return sb.ToString();

No comments:

Post a Comment