<%@ control language="C#" autoeventwireup="true" inherits="Shop_ProvinceCity, WebApp_deploy" %>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True"/>
<table>
   <tr>
      <td><asp:DropDownList ID="Province" runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource1" DataTextField="Province" DataValueField="Province" Width="100px"  OnSelectedIndexChanged="OnProvinceSelectedIndexChanged" /></td>
      <td>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
              <asp:DropDownList ID="City" runat="server" AutoPostBack="True" DataSourceID="ObjectDataSource2" DataTextField="City" DataValueField="City" Width="100px"  OnSelectedIndexChanged="OnCitySelectedIndexChanged" />&nbsp;市
          </ContentTemplate>
          <Triggers>
              <asp:AsyncPostBackTrigger  ControlID="Province" EventName="SelectedIndexChanged" />
          </Triggers>
      </asp:UpdatePanel>
      </td>
      <td>
      <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>
            <asp:DropDownList ID="Area" runat="server" AutoPostBack="false" DataSourceID="ObjectDataSource3" DataTextField="Area" DataValueField="Area" Width="100px" />&nbsp;区
            &nbsp;&nbsp;
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="City" EventName="SelectedIndexChanged" />
            <asp:AsyncPostBackTrigger ControlID="Province" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>
    </td>
   </tr> 
</table>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetProvince" TypeName="ChinaCity"></asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetCityByProvince" TypeName="ChinaCity">
    <SelectParameters>
        <asp:ControlParameter ControlID="Province" DefaultValue="-1" Name="Province" PropertyName="SelectedValue"
            Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="GetAreaByCity" TypeName="ChinaCity">
    <SelectParameters>
        <asp:ControlParameter ControlID="City" DefaultValue="-1" Name="City" PropertyName="SelectedValue"
            Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
