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?


5 Years
Discussion Span
Last Post by icedome

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 :)

Edited by icedome: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.