mattdaddym
New member
- Joined
- Apr 30, 2010
- Messages
- 2
- Programming Experience
- 3-5
Hi,
I have a dropdownlist that is databound to a sqldatasource. I need to set the default value of the dropdownlist to the username stored in a session variable.
I tried this in the Page_Load, but I get an error that the value does not exist. I assume this is because I am trying to set the value before the databinding has occurred.
I also tried to handle the OnBound event of the dropdownlist. This time I do not get an error, but the dropdownlist does not set to the value I would like. I have verified that the value I want is being bound to the dropdownlist and that my session variable value does equal what I believe it should.
In a nutshell. 1) dropdownlist is databound to sqldatasource 2) How can I set the default value programatically to a username variable?
Sorry, I'm not posting any code as there really isn't any to post. Hopefully just a straightforward rookie question. I found many similar situations when I searched, but most involved adding items to the list that weren't databound...not my situation. Thanks all!
I have a dropdownlist that is databound to a sqldatasource. I need to set the default value of the dropdownlist to the username stored in a session variable.
I tried this in the Page_Load, but I get an error that the value does not exist. I assume this is because I am trying to set the value before the databinding has occurred.
I also tried to handle the OnBound event of the dropdownlist. This time I do not get an error, but the dropdownlist does not set to the value I would like. I have verified that the value I want is being bound to the dropdownlist and that my session variable value does equal what I believe it should.
In a nutshell. 1) dropdownlist is databound to sqldatasource 2) How can I set the default value programatically to a username variable?
Sorry, I'm not posting any code as there really isn't any to post. Hopefully just a straightforward rookie question. I found many similar situations when I searched, but most involved adding items to the list that weren't databound...not my situation. Thanks all!