Wednesday, August 19, 2009
Thursday, August 6, 2009
Dynamically add the control to Gridview
I write the code in rowcommand event
//getting value through commandArgument
lblPuser.Text = Convert.ToString (e.CommandArgument);
LinkButton lkAllow = new LinkButton();
lkAllow.Text = "e";
GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;
//you can bind data here
ddl.Items.Add("Allocate Area");
ddl.Items.Add("Kukatpalli");
ddl.Items.Add("DSNR");
ddl.Items.Add("Mettuguda");
row.Cells[5].Controls.Add(ddl);
ddl.AutoPostBack = true;
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
through this code you can add dropdownlist dynamically but after postback event dropdwonlist is not visible......
I need to write this in page load event.........?
//getting value through commandArgument
lblPuser.Text = Convert.ToString (e.CommandArgument);
LinkButton lkAllow = new LinkButton();
lkAllow.Text = "e";
GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;
//you can bind data here
ddl.Items.Add("Allocate Area");
ddl.Items.Add("Kukatpalli");
ddl.Items.Add("DSNR");
ddl.Items.Add("Mettuguda");
row.Cells[5].Controls.Add(ddl);
ddl.AutoPostBack = true;
ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
through this code you can add dropdownlist dynamically but after postback event dropdwonlist is not visible......
I need to write this in page load event.........?
Subscribe to:
Comments (Atom)