P
Phani
I have two datagrids .... after handling the click event in one datagrid
..... using its data i query the database and get the data for the second
datagrid
in both the grids i am generating the columns dynamically
the problem is in the second datagrid the columns are appearing twice
i dont know y ??
like if "a |b |c|" are the actual columns to be displayed
they r displayed as
a|b|c|a|b|c|
can anyone help me???/
this is my onitemcommand code
protected void Item_click(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int key = Convert.ToInt32 (DataGrid1.DataKeys[e.Item.ItemIndex]);
SqlDataReader read = project.GetSingleProject (key);
if(read.Read ())
{
string name = read["ProjectName"].ToString ();
Label1.Text = "Tasks Related to "+name;
}
TasksDB task=new TasksDB ();
DataSet ds = task.GetTasks (key);
DataGrid2.DataSource =ds;
DataGrid2.AutoGenerateColumns =false;
foreach(DataColumn c in ds.Tables [0].Columns )
DataGrid2.Columns .Add (CreateBoundColumn(c));
DataGrid2.DataBind ();
}
..... using its data i query the database and get the data for the second
datagrid
in both the grids i am generating the columns dynamically
the problem is in the second datagrid the columns are appearing twice
i dont know y ??
like if "a |b |c|" are the actual columns to be displayed
they r displayed as
a|b|c|a|b|c|
can anyone help me???/
this is my onitemcommand code
protected void Item_click(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int key = Convert.ToInt32 (DataGrid1.DataKeys[e.Item.ItemIndex]);
SqlDataReader read = project.GetSingleProject (key);
if(read.Read ())
{
string name = read["ProjectName"].ToString ();
Label1.Text = "Tasks Related to "+name;
}
TasksDB task=new TasksDB ();
DataSet ds = task.GetTasks (key);
DataGrid2.DataSource =ds;
DataGrid2.AutoGenerateColumns =false;
foreach(DataColumn c in ds.Tables [0].Columns )
DataGrid2.Columns .Add (CreateBoundColumn(c));
DataGrid2.DataBind ();
}