简体   繁体   English

如何使用自动回发?

[英]How to use AutoPostback?

For example:例如:

Region: <asp:ListBox ID="RegionListBox2" runat="server" DataSourceID="SqlDataSource1" DataTextField="RegionName" DataValueField="RegionName"></asp:ListBox>

        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

        Munipacility: <asp:DropDownList ID="MunipacilityDropDown" runat="server"></asp:DropDownList>

Now 1 region contains many municipalities.现在 1 个地区包含许多自治市。 When i click region in the listbox i want the municipalities from that region to show on the dropdownlist.当我单击列表框中的区域时,我希望该区域的市政当局显示在下拉列表中。 For example when i click the button it works just perfectly it shows the municipalities, but i want for it to work somehow with postback so when i click it automatically will show them.例如,当我单击该按钮时,它可以完美地显示市政当局,但是我希望它以某种方式与回发一起工作,因此当我单击它时会自动显示它们。

According to the documentation you just need to set 'AutoPostback' to True.根据文档,您只需将“AutoPostback”设置为 True。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM