Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RE: DropDownList SelectedValue is always first value

Reply
Thread Tools

RE: DropDownList SelectedValue is always first value

 
 
=?Utf-8?B?bXIgZm94?=
Guest
Posts: n/a
 
      05-16-2005
You may be accessing the value before the viewstate has been loaded and
control values updated from the form post. Try looking at the value in
PreRender to check if this is the case.

Regards,

mr fox.

"Sam C via .NET 247" wrote:

> Hi,
>
> I have a really irritating problem with an ASP.NET page that I'm trying to get to work. It includes a DropDownList which I populate with ListItems in the Page_Load in cases where IsPostBack = False.
>
> When using any of the several methods to get the selected item in the DDL it always returns the first one in the DropDownList despite the fact that one of the other items may actually be selected. I've tried
>
> I've now made the page just write out the value of the DDL.SelectedItem as a debugging tool. The odd thing is that, if I resubmit the form it then starts to get the right value but, of course, it's the first time the form is submitted that I really need it to be right.
>
> I'd appreciate any help and can post any code that is needed. I see from other forum posts that some others have had the same problem but the only advice they get is to make sure the IsPostBack is used in an IF statement in Page_Load which I am doing.
>
> Thanks,
>
> Sam
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotnet247.com/)
>
> <Id>m96oaRmQAkGDbrjEmcot9g==</Id>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get SelectedValue of DropDownList in User Control in WebForm gu4y ASP .Net 4 01-13-2010 04:27 AM
Data Binding Problem in DropDownList Control SelectedValue to Table text field Tom Jorgenson ASP .Net 3 03-09-2007 10:42 AM
Getting DropDownList DataTextField Value? Given the SelectedValue and/or SelectedIndex jobs ASP .Net 0 11-06-2006 09:17 PM
DropDownList always returning the first item Siamak Zahedi ASP .Net 3 01-28-2005 02:08 PM
DropDownList.SelectedValue not changing Jesse ASP .Net 3 07-24-2003 08:48 PM



Advertisments