Reputation: 15706
I want to change the 2nd dropdownlist based on the choice of 1st dropdownlist. The data is not too much in my case.
I don't want to trigger postback when choosing the 1st dropdownlist.
I'll use linq to sql to save the data into DB after submission.
What I think of is the following :
Get all the data in JSON format, and use javascript to load the 2nd dropdownlist. But in this case, we cannot ensure the value of 2nd ddl is correct (and turn the enableeventvalidation to false). I think it's less secure for sql injection, but using linq to sql, it should not be a problem.
What will you do? Is there any better way to do this?
Upvotes: 0
Views: 356
Reputation: 21078
can / do you want to use the ajax toolkit? Has cascading dropdown just for this?
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/CascadingDropDown.aspx
Upvotes: 1
Reputation: 8421
Have you considered a cascading drop down list? I'm not sure if it suits your needs exactly but it's worth checking out.
Upvotes: 1