Check your debugger values, the FindControls are not finding the dropdownlist.
Unfortuantely, the item has been finded correctly. I just add "ddl.Visible = false;" and expectable control has been disappeared.May be this issue connected with that CascadingDropDown was placed into "UpdatePanel"? Here is the life of this control: 1. creation an update panel2. creation table3. creation 3 drodownlists(+setting default value ("0","New") to each) and 3 cascadingdropdowns4. programmatically disabling dropdowns and cascadingdropdowns5. creation "ImageButton" - for controls activation and data retrivement4. table.add(controls)5. updatepanel.add(table)So, in the PageLoad all controls are disabled (it connects with too long population time), and after Image Button has been pressed, UpdatePanel renews. All controls are became active, but i'm still cant get the value of the last dropdown control, only "0", as a default value.Best regards.
DropDownList ddl = (DropDownList)up.FindControl("tab_").FindControl("ddlroom_");
string val = ddl.SelectedItem.Value;
Do you, or do you not, get an 'object reference' error on the bold line?
Your second post seems to contradict your first, so I'm not sure what you are saying.
If you are getting that error on the bolded line above, add this before the line:
if (ddl == null)
{
throw new exception ("Did not find drop down list ddl.");
}
It should throw the exception when you run it.
If you are not getting an error on that line, then you need to post the code that is giving you an error...
Hello! Sorry, for the contradiction, its really take place. First post - the List item with ("0","New") parametres had not been added to the third DropDownList. In that case i have got an error "couldn't get object reference". Second post already accord to situation, when List item with ("0","New") had been added, and command string val = ddl.SelectedItem.Value; returns me Old value "0",without error, but without new selected value also.Best regards.
If you want more help, post the code... :)
No comments:
Post a Comment