Mike,
For a dropdown, you don't set the value like
DropDownList1.SelectedItem.Value = "xyz". Instead, you do this
DropDownList1.SelecteIndex = i; //i is the index of value "xyz" in the
dropdown, starting from 0.
Make sure only set it once in the Page_Load event like,
if(!Page.IsPostBack)
{
DropDownList1.SelectedIndex = 1;
DropDownList1.Enabled = false;//you can still get the value on postaback
DropDownList1.Visible = false;//you can still get the value on postaback
}
In the postback, I am sure you can get the value through code like,
string ddlvalue = DropDownList1.SelectedItem.Value;
It doesn't matter the ddl is enabled or not. The ddl can even be invisible.
L.L.
"Mike Hnatt" <do**@gladstone-inc.com> wrote in message
news:vp************@corp.supernews.com...
I have code that will set a drop-down list value to "xyz" and the .Enabled
property to False. However, when I do that I can no longer retrieve the
value "xyz" upon postback. It is as if I set the .Visible property to
False as well and the control wasn't rendered, but I did not. If you View
Source of the rendered HTML, you can see that the control is indeed still intact
(everything is the same except the disabled argument is set to
"disabled").
Why can't I get the value when I disable a control?
Thanks,
Mike