Life in my own company

Its all up to me.
posts - 138, comments - 219, trackbacks - 109

My Links

News



Twitter



Tag Cloud

Archives

Post Categories

Play

Work

DropDownList Trouble

I was fighting with a drop down list on Friday, and I never did figure out what was going on.

The list contains a set of all of the states in the US and the provinces in Canada and is bound to a DataSet.  The user fills out a simple form (city and state) and the clicks on search.  On the post back, server side, I looked for the value of the state, and it was always set to the first value in the dataset.

First thing I found was that the list was being reloaded on the page reload.  I took steps to stop that, but still, it didn't contain the value that was submitted back to the form.

I looked through all of the Request.Form values and found this:

_ctl0:_ctl2:_ctl0:ddlLocality

However, that didn't match the ddlLocality.ClientId value, which was set to this:

_ctl0__ctl2__ctl0_ddlLocality

No matter what I did, I couldn't get the locality box to post information back so that when I did a ddlLocality.SelectedValue, the value that was selected appeared, even though the value was set in in the Request.Form.

So to work around it, I did this:

   for (int i=0;i < Request.Form.Count;i++)
   {
    if (Request.Form.Keys[i].IndexOf("ddlLocality") > 0)
    {
     m_selectedValue=Request.Form[i];
    }
   }

Then in the state load, I set the value to what I found in the query string.  We're using dotnetnuke 2.1.2.  Anybody have any ideas why the value wouldn't be picked up by ASP.NET?

Weird.

Print | posted on Monday, January 16, 2006 8:41 AM | Filed Under [ Work ]

Feedback

Gravatar

# re: DropDownList Trouble

This looks like a pre-patched ASP.Net 1.1

The IDs post-patch for both ClientID and that property are delimited with a more usable '$'.

1/16/2006 12:16 PM | Eric Newton
Gravatar

# re: DropDownList Trouble

Interesting--I'm running version 1.1.4322.2300. Is there a hotfix that I'm not aware of?
1/16/2006 12:44 PM | Robert May
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: