Bobby X
asked on
need help on ControlID
Hi,
I have the code-behind below that's working just fine when I use it in regular aspx page, but once I put the dropdownlist control "ddlState" in a content page of a master page, it starts giving an error "Could not find control 'ctl00_secondPageContent_d dlState' in ControlParameter 'state_id'.", where "secondPageContent" is the ID of the contentplaceholder containing the dropdownlist "ddlState". Can someone tell me how to fix this?
Thanks.
I have the code-behind below that's working just fine when I use it in regular aspx page, but once I put the dropdownlist control "ddlState" in a content page of a master page, it starts giving an error "Could not find control 'ctl00_secondPageContent_d
Thanks.
odsLocs.SelectMethod = "SelectOfficeByState";
ControlParameter stateIDParam = new ControlParameter();
stateIDParam.ControlID = "ddlState";
stateIDParam.Name = "state_id";
stateIDParam.PropertyName = "SelectedValue";
odsLocs.SelectParameters.Clear();
odsLocs.SelectParameters.Add(stateIDParam);
dlLocations.Caption = captionText + "<br /><br />Offices in State:";
dlLocations.DataSource = odsLocs.Select();
dlLocations.DataBind();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DropDownList ddl = (DropDownList)this.FindCon
ControlParameter stateIDParam = new ControlParameter();
stateIDParam.ControlID = ddl.ClientID;
not tested but try and see if that works..