This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Sunday, November 2, 2008

asp.net code to Converting a DataGrid to HTML and outputting it to screen

This code shows you how to convert a DataGrid to HTML and outputting it to screen

CODE:
string ConnStr = "Server=servername;Database=databasename;UID=username;PWD=password;";
SqlConnection sqlConn = new SqlConnection(ConnStr);
string query = "getTest";
SqlCommand sqlComm = new SqlCommand(query,sqlConn);
sqlComm.CommandType=CommandType.StoredProcedure;
sqlConn.Open();
SqlDataReader sqlReader;
sqlReader = sqlComm.ExecuteReader();
dgView.DataSource = sqlReader;
dgView.DataBind();
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
dgView.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter);
Response.End();

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger