Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Database driven pull down lists


Message #1 by "Sion Edwards" <sion@h...> on Thu, 9 May 2002 12:05:45
I have populated a pull down list from a database Table using a datareader.

The combo box will show a Name and the value of the item will be the ID of 
the field.

For the DataTextField property I have chosen the field with what I want 
the user to see in the pull down menu, and for the dataValueField I have 
chosen the ID field for the item in the pull down list.

The problem I am having is the dataValueField value does not change when a 
different item is selected from the pull down list. Can anyone help?

Thanks

Sion
Message #2 by Ali Ahmad H <aheryana@b...> on Fri, 10 May 2002 09:10:21 +0700
Hi Sion,
Please try to use IsPostBack when you call a Page_Load.
Here is the example code using C# :

private void Page_Load(object sender, System.EventArgs e)
{
         if ( !Page.IsPostBack )
         {
                 //Call your function / script to fill your pulldown list 
from database here
         }
}

regards,
-ali-
http://www.aliahmad.net


At 12:05 PM 5/9/2002 +0000, you wrote:
>I have populated a pull down list from a database Table using a datareader.
>
>The combo box will show a Name and the value of the item will be the ID of
>the field.
>
>For the DataTextField property I have chosen the field with what I want
>the user to see in the pull down menu, and for the dataValueField I have
>chosen the ID field for the item in the pull down list.
>
>The problem I am having is the dataValueField value does not change when a
>different item is selected from the pull down list. Can anyone help?
>
>Thanks
>
>Sion



  Return to Index