D
dkehring
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
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