Hi guys,

I'm having some trouble finding a control... that is because this control is on gridview witch is inside repeater (let's call it rpt1) and this repeater is inside another repeater (this one, rpt2).. I have an ItemCommand on rpt1 witch I need to catch a dropdownlist item value that is created as an item template inside the gridview... but just can't find it..

I have tryed something like this:

DropDownList ddlPersons = (DropDownList)e.item.FindControl("ddlPersons");

and also even this:

DropDownList ddlPersons = (DropDownList)this.Page.FindControl("ddlPersons");

But no luck with both ways.. does anyone knows how can I find my control?


Well... my first post has just been solved... I've forgot to include the row in the findcontrol... the code should be like this:

DropDownList ddlPersons = (DropDownList)gridview1.Rows[0].FindControl("ddlPersons"); // of course, that the number inside the Rows[] is the row index

Hope that this could be useful to someone :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.