"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Ol**************@TK2MSFTNGP10.phx.gbl...
Everything looks fine. We'd need to see how you are populating your
dropdown with respect to that line? are you binding after? before? how
are
you handling postback?
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Simon Harvey" <sh856531@microsofts_free_email_service.com> wrote in
message
news:%2****************@TK2MSFTNGP14.phx.gbl... Hi all,
Am I being really stupid here:
myDropDown.SelectedIndex = 2
I think this line should set the dropdown control's selected item to 2.
But nothing seems to be happening on the page. The dropdown just maintains
its
default value (element 0).
Do I have to do something else to get this control to work? The only
other
aspect that may be effecting this piece of code is the fact that the drop
down is contained within a user control that itself is contained in a
user
control. But I don't see why that should matter.
Do I have to do something with viewstate or something tricky like that?
Many thanks to anyone who can help
Kindest Regards
Simon
Hi Karl,
I don't do any databinding directly. At some point earlier in the program I
get a 2 ints representing a range, eg 1 5.
Then I do a loop and the following:
Grade 1
Grade 2
....
Grade 5
The problem occurs at somepoint after this. The control populates itself
fine, it just doesnt seem to do anything when I tell it what index to go to.
As for postback, I'm not actually doing a postback. This problem occurs when
loading the page for the very first time.
I wish I could show you some more code buts its actually really complicated
and all over the place because of the nature of the program.
Can you imagine why this would be happening. The only real thing i can think
of is that some other bit of code is running and reseting the value back to
0 before the page is sent to the browser. Do you think there is anything
else it could be?
Thanks
Simon