how to use grid view and data grid view using c sharp
Regards,
RAO
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jul 22, 2012, 11:50 PM
Please refer
http://www.dotnetspider.com/resources/Category518-ASP.NET-GridView.aspx
http://asp-net-example.blogspot.in/2008/10/gridview-example-how-to-use-gridview-in.html
Advanced link
http://www.codeproject.com/Articles/14293/Gridview-Inside-a-GridView-in-ASP-NET-2-0
hope this will help you.
Satyapriya NayakPosted Jul 22, 2012, 11:45 AM
In Web apps we use Gridview and windows apps we use datagridview
Ex:-In web
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Gridview._Default" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Gridview
{
public partial class _Default : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
string str;
protected void Page_Load(object sender, EventArgs e)
{
bindgrid();
}
private void bindgrid()
{
SqlConnection con = new SqlConnection(connStr);
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "employee");
g1.DataMember = "employee";
g1.DataSource = ds;
g1.DataBind();
con.Close();
}
}
}
Thanks