<asp:UpdatePanel runat="server" UpdateMode="Always" ChildrenAsTriggers="true"> <ContentTemplate> City: <asp:DropDownList ID="ddlCity" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlCity_SelectedIndexChanged"> </asp:DropDownList> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlCity" EventName="selectedindexchanged" /> </Triggers> </asp:UpdatePanel>
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { //code to load yo dropdown } }
if (!IsPostBack) { //code to load yo dropdown }
In Trigger <asp:AsyncPostBackTrigger ControlID="ddlCity" EventName="SelectedIndexChanged"/> in cs you must have protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e) { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)