»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
adding datagrid items at run time
DataRow dr;
DataSet ds = new DataSet();
ds.Tables.Add("DGStandIn");
ds.Tables["DGStandIn"].Columns.Add("ID",typeof(int));
//dgVanity is the datagrid name
for(int i = 0; i < nos; i++)
{
dr = ds.Tables["DGStandIn"].NewRow();
dr[0]=i;
ds.Tables["DGStandIn"].Rows.Add(dr);
}
dgVanity.DataSource = ds.Tables["DGStandIn"];
dgVanity.DataBind();
///////////////////// to loop through the datagrid items
foreach(DataGridItem i in dgVanity.Items)
{
if(((RadioButton)(i.FindControl("controlname"))).Checked)
{
//actions here
}
} |
|