DropDownList Implementation of Ajax without refreshing three-level linkage error solutions for new provinces and cities

Source: Internet
Author: User

Solution:

(Change the dropdownlist to the client-side html control select and store it using ajax. There will certainly be no errors.

But here the form has a lot of data to be submitted, so do not consider using the client html Control)

1. <% @ page language = "c #" autoeventwireup = "true" on the page"

Codefile = "default. asp tutorial x. cs" inherits = "_ default" %> Add

Enableeventvalidation = "false ";

2. Add a hidden field <input type = "hidden" id = "inputcity" runat = "server"/>

Then, use js to assign the value of dropdownlist to the hidden domain,

In this way, the background can read the value of the hidden domain through inputcity. value, that is, the value selected by the province and city.

Value


Problem

Use the dropdownlist control on the server side to implement three-level linkage between ajax-free new provinces and cities

Province: <asp: dropdownlist id = "ddlprovince" runat = "server"

Enableviewstate = "false"> </asp: dropdownlist>
City: <asp: dropdownlist id = "ddlcity" runat = "server"

Enableviewstate = "false"> </asp: dropdownlist>
Area: <asp: dropdownlist id = "ddlcounty" runat = "server"

Enableviewstate = "false"> </asp: dropdownlist>

 

Practice:

When loading a page, first load the "Province" data, and then add the "please select" item to the city and district respectively.

Jquery's $. post () method successfully achieves the smooth implementation of ajax without refreshing new provincial/municipal linkages

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.