Hello everybody!
I need to creat a table (using DataGrid) with linkButtons in it's columns. DataGrid gets information from DB:
SqlDataAdapter myData = new SqlDataAdapter("SELECT City, Product FROM City WHERE Year = " + year + " AND Month = '" + month.ToString() + "' AND Product = '" + product.ToString() + "' ORDER BY City", sqlConnection);
DataSet ds = new DataSet();
myData.Fill(ds);
dgCities.DataSource = ds.Tables[0].DefaultView;
dgCities.DataBind();
But i do not understand how to put in each cell linkbutton with .text = information from DB?
And another question. Am i able to create DataGrid which will be not only vertical but for example 5 columns with 10 strings in each column. I mean something like this:
Name Number | Name Number | Name Number
Alex 011 | Peter 023 | Jean 111
Alexey 012 | Robert 024 | Olga 131
Or i have to creat 5 DataGrids and bind data from DB to first from 1 to 10, to second from 11 to 20 i.e.?
Then one more question, how to show information in datagrid from 11 string to 20 if it has for example 50 strings?
I'll be very very very thankful for help!
Best regards!
Alexander
I need to creat a table (using DataGrid) with linkButtons in it's columns. DataGrid gets information from DB:
SqlDataAdapter myData = new SqlDataAdapter("SELECT City, Product FROM City WHERE Year = " + year + " AND Month = '" + month.ToString() + "' AND Product = '" + product.ToString() + "' ORDER BY City", sqlConnection);
DataSet ds = new DataSet();
myData.Fill(ds);
dgCities.DataSource = ds.Tables[0].DefaultView;
dgCities.DataBind();
But i do not understand how to put in each cell linkbutton with .text = information from DB?
And another question. Am i able to create DataGrid which will be not only vertical but for example 5 columns with 10 strings in each column. I mean something like this:
Name Number | Name Number | Name Number
Alex 011 | Peter 023 | Jean 111
Alexey 012 | Robert 024 | Olga 131
Or i have to creat 5 DataGrids and bind data from DB to first from 1 to 10, to second from 11 to 20 i.e.?
Then one more question, how to show information in datagrid from 11 string to 20 if it has for example 50 strings?
I'll be very very very thankful for help!
Best regards!
Alexander