DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 26 Jul 2007 11:40:02 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    dkehring


Adding dropdownlist options via Javascript   
Hi,

Using VS.NET 2005...

I created a custom web control based on the CompositeControl class. This 
control creates a table with two columns of DropDownList (DDL) objects. The 
DDL objects in the first column are populated with values on the server side. 
When the user selects an option from the DDL in the first column, I make an 
asychronous callback (AJAX) to a web service on the server to get a list of 
options for the selected value in the first DDL. The result of this call 
returns a string that I split into name/value pairs and use this to populate 
the adjacent DDL in the second column via Javascript. When I post back to the 
server, I want to be able to get the value selected in the second DDL. On 
postback I recreate the DDLs (by overriding CreateChildControls) but the 
second DDL does not show the selected value. 

To start, I added an event handler for the first DDL's SelectedIndexChanged 
event. When I trap this I get the value from the DDL and use this to load the 
list of values and populate the second DDL. However, the value coming back 
from postback does not "select" the option from the list. I figure that I'm 
not doing this at the right time in the page's life cycle but I can't figure 
out how to populate the second DDL prior to the selected value being set in 
the second DDL (which I assume happens during the LoadPostBackData method of 
the control). 

Any ideas how to handle this correctly?

Regards,
Dave
Date:Thu, 26 Jul 2007 11:40:02 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us