I'm trying to set focus on a Dropdownlist that's being populated by the nice CascadingDropDown tool. But I can't. Everything else works great, The forms retreive, insert, update without page postbacks via updatepanel. The CascadingDropDown tools work well with the dropdownlists and it all populates dependent on each other and without page postbacks. BUT I can't seem to set the focus to the dropdownlist that's being populated by the CascadingDropDown tool..
I've got the scriptmanager on the masterpage and the Dropdownlist I want to set focus upon is in a formview. I want it to set focus on the control when the form is changed to a insert or edit mode.
So my code behind is like this:
protectedvoid formView1_ModeChanged(object sender,EventArgs e)
{
if (formView1.CurrentMode ==FormViewMode.Insert || formView1.CurrentMode ==FormViewMode.Edit)
{
Master.ScriptManager1.SetFocus(formView1.FindControl("ddl_iWantFocused"));
}
}
Works great for selecting any other control in the form, but not the one populated with the CascadingDropDown.
Any help on how to set focus on this?
Let me revise that. I can SetFocus on other DropDownLists that don't use the CascadingDropDownList extender, but haven't been able to SetFocus on a Textbox.
No comments:
Post a Comment