data grid

  • Thread starter Thread starter bushi
  • Start date Start date
B

bushi

hi every one!
i'm trying to display my data using DataGrid,there is no Data
Grid control available in asp.net(vs 2005).i'm trying to do it
programmatically,but it shows nothing:i have used the following code:

con.Open();
OleDbCommand cmd1 = con.CreateCommand();
OleDbDataAdapter dap = new OleDbDataAdapter("select * from
admin", con);
OleDbCommandBuilder cb = new OleDbCommandBuilder(dap);
DataSet ds = new DataSet();
ds.Fill(dap, 0, 0, "admin");
DataGrid dg=new DataGrid();
dg.DataSource=ds;
con.Close();

plz guid me how to do it,i will wait anxiously
 
"there is no Data Grid control available in asp.net(vs 2005)"

good grace it is not available !!!


you have GridView that is much more powerfull that DataGrid ;-)

http://www.gridviewguy.com has a lot of wonderful articlaes so you can
see what you can accomplish with this beutifull control

Bruno Alexandre
 
i'm trying to display my data using DataGrid,

there is no DataGrid control available in asp.net

The DataGrid control is still there if you absolutely must use it...

<asp:DataGrid ID="MyDataGrid" runat="server" />
 
// con.open(); not required.
OleDbCommand cmd1 = con.CreateCommand("add connection string here");
OleDbDataAdapter dap = new OleDbDataAdapter("select * from admin",
con);
// OleDbCommandBuilder cb = new OleDbCommandBuilder(dap); not required
DataSet ds = new DataSet();
ds.Fill(dap);
// DataGrid dg=new DataGrid(); place the control using page designer
dg.DataSource=ds;

// con.Close(); not required
dg.DataBind(); // add this line

-Praveen
 
OOps! error,
Conection stirng is not rquired on line number 3. Infact you dont need that
line at all!
 
Datagrid is there - just add it to the Toolbox. As mentioned, DataGridView is
better and does all the same and more.
Peter
 
thanx Mark...
it helps me.now tell me how i can update or delete the
records in it???
plzzzzzzz rply as soon as possible........
 
Back
Top