C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » General »

GridView


Posted Date: 14 Oct 2009    Resource Type: Articles    Category: General
Author: hemantMember Level: Bronze    
Rating: 1 out of 5Points: 7



The GridView control solves a problem that has plagued developers for years: data presentation. The GridView control generates simple HTML tables, so information within a GridView is presented to the end user in a familiar , cleanly formatted, tabular structure.

the GridView control provides the following functionality:
¦database table-like presentation of data
¦table headers and footers
¦paging
¦sorting
¦style modification through templates
¦customizable columns for advanced editing

To Use

<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1>Address Book</h1>
<asp:GridView id="grid" runat="server" />
</asp:Content>

To BInd

using System;
using System.Data.SqlClient;
public partial class AddressBook : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
private void BindGrid()
{
SqlConnection conn;
SqlCommand comm;
SqlDataReader reader;
string connectionString =ConfigurationManager.ConnectionStrings["Dorknozzle"].ConnectionString;
conn = new SqlConnection(connectionString);
comm = new SqlCommand("SELECT EmployeeID, Name, City, State, MobilePhone " +
"FROM Employees", conn);
try
{
conn.Open();
reader = comm.ExecuteReader();
grid.DataSource = reader;
grid.DataBind();
reader.Close();
}
finally
{
conn.Close();
}
}
}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Using the Gridview  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: About sitemap generator
Previous Resource: Data for blank DVD
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use