Ajax cascadingdropdown dropdownlist second-level linkage rebinding data loss data processing

Source: Internet
Author: User
I have been searching for half a day on Baidu. No one answered such a question positively. Here I will share my experience.
How to Use the Ajax control cascadingdropdown to implement multi-level linkage binding.

There are many multi-level linkages on the Network (simple: Secondary linkage, for example, the first dropdown is the province, and the first dropdown is the city). This is omitted.

This section describes how to rebind the stored data to the Ajax control.
Prerequisites: 1. I used sqldatasource to bind the "Province", and used Ajax: cascadingdropdown to map the "city ".
2. The city data comes from the web service. When the province is selected, the sub-market that saves the return value is sent to the web service.

Step: 1. Bind the Save value of the province to the event after the province is bound
 

Protected void ddldivisions_databound (Object sender, eventargs E)
...{
Ddldivisions. Items. findbyvalue (profile. approvalfilterparameters. divisionid. tostring (). Selected = true;
}

2. Set the selectvalue of CDD (cascadingdropdown) in advance in page_load, set the set first, and hit this data subset. If (! Ispostback)
...{
If (profile. approvalfilterparameters. Saved)
Cddoffices. selectedvalue = profile. approvalfilterparameters. officeid. tostring ();
}

In this case, on the client side, the Ajax control will automatically retrieve the province settings, retrieve the child set from the Web service, and then bind the "city" drop down, but because selectedvalue has been set before, in this way, the multi-level linkage can be re-bound.

The meeting is not difficult, but not difficult.
This little thing made me research from the life cycle in the afternoon.
If you can help everyone, give a comment and write it yourself, which is messy.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.