如何让jQuery选择元素。在他们的身份证里?
public School{ public Int32 ID { get; set; } publig String Name { get; set; } public Address Address { get; set; }}public class Address{ public string Street1 { get; set; } public string City { get; set; } public String ZipCode { get; set; } public String State { get; set; } public String Country { get; set; }}[Authorize(Roles = "SchoolEditor")][AcceptVerbs(HttpVerbs.Post)] public SchoolResponse Edit(Int32 id, FormCollection form){ School school = GetSchoolFromRepository(id); UpdateModel(school, form); return new SchoolResponse() { School = school };}
<form method="post"> School: <%= Html.TextBox("Name") %><br /> Street: <%= Html.TextBox("Address.Street") %><br /> City: <%= Html.TextBox("Address.City") %><br /> Zip Code: <%= Html.TextBox("Address.ZipCode") %><br /> Sate: <select id="Address.State"></select><br /> Country: <select id="Address.Country"></select><br /></form>
$(function() { $.getJSON("/Location/GetCountryList", null, function(data) { $("#Address.Country").fillSelect(data); }); $("#Address.Country").change(function() { $.getJSON("/Location/GetRegionsForCountry", { country: $(this).val() }, function(data) { $("#Address.State").fillSelect(data); }); });});
慕侠2389804
MM们
相关分类