V
vmssanthosh
hi
Actually, i am trying to add controls dynamically to Gridview cells in
asp.net 2.0.. but the controls are not getting added in the gridview..
i tried to add those controls in panel.. it also not working... i
tried it in visual studio 2003.. my code is working fine with 2003.. is
there is any syntax change in 2005... pls help me...
This is the code that what i am trying
DropDownList ddl4gdvw=new DropDownList();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddl4gdvw.Items.Add("Girisha");
ddl4gdvw.Items.Add("VMSSanthosh");
ddl4gdvw.Items.Add("SRaja");
ddl4gdvw.Visible = true;
Panel1.Controls.Add(ddl4gdvw);
Panel1.BackColor = System.Drawing.Color.Aqua;
DataTable dtgdvwddl = new DataTable();
dtgdvwddl.Columns.Add("something").DefaultValue="Hi";
dtgdvwddl.Columns.Add("Nothing").DefaultValue="Bye";
for(int i=0;i<5;i++)
dtgdvwddl.Rows.Add(dtgdvwddl.NewRow());
gdvwWithddl.DataSource = dtgdvwddl;
gdvwWithddl.DataBind();
}
}
protected void gdvwWithddl_RowDataBound(object sender,
GridViewRowEventArgs e)
{
e.Row.Cells[1].Controls.Add(ddl4gdvw);
}
}
Actually, i am trying to add controls dynamically to Gridview cells in
asp.net 2.0.. but the controls are not getting added in the gridview..
i tried to add those controls in panel.. it also not working... i
tried it in visual studio 2003.. my code is working fine with 2003.. is
there is any syntax change in 2005... pls help me...
This is the code that what i am trying
DropDownList ddl4gdvw=new DropDownList();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ddl4gdvw.Items.Add("Girisha");
ddl4gdvw.Items.Add("VMSSanthosh");
ddl4gdvw.Items.Add("SRaja");
ddl4gdvw.Visible = true;
Panel1.Controls.Add(ddl4gdvw);
Panel1.BackColor = System.Drawing.Color.Aqua;
DataTable dtgdvwddl = new DataTable();
dtgdvwddl.Columns.Add("something").DefaultValue="Hi";
dtgdvwddl.Columns.Add("Nothing").DefaultValue="Bye";
for(int i=0;i<5;i++)
dtgdvwddl.Rows.Add(dtgdvwddl.NewRow());
gdvwWithddl.DataSource = dtgdvwddl;
gdvwWithddl.DataBind();
}
}
protected void gdvwWithddl_RowDataBound(object sender,
GridViewRowEventArgs e)
{
e.Row.Cells[1].Controls.Add(ddl4gdvw);
}
}