简体   繁体   中英

Will postback in asp.net always causes a “navigate away” warning

I have a pretty simple questions that had stumped me so far .. I am trying to do a one-level cascading drop down in ASP.NET.

So, I have two drop down boxes (among other text boxes), after ddlOne is selected, then ddlTwo will be populated.

here's my code in aspx

<asp:UpdatePanel ID="comboBoxWorkFlowPanel" runat="server">
<ContentTemplate>
        <asp:DropDownList ID="ddlPendingUserGroup" runat="server" 
        DataTextField="groupName" DataValueField="groupId" OnSelectedIndexChanged="ddlPendingUserGroup_SelectedIndexChanged" AutoPostBack="true">                                                                                        
         </asp:DropDownList>
        <asp:DropDownList ID="ddlUserGroupUsers" runat="server" Enabled="false"DataTextField="userName" DataValueField="userID"></asp:DropDownList>
</ContentTemplate>
<asp:UpdatePanel>

and pretty much in the code behind page, the event handler will read from the drop down and then populate the second drop down.

my question is, after the selection is made in the first drop down, why am i getting a warning message ("you're about to navigate away from this page")

If i click ok on the warning message, the dropdown box will be loaded correctly, and other values that were previously on the page will be preserved. If i click cancel, i get a script error instead.

any thoughts on this?

Actually, that seems quite odd. There must be something more than what you've put here going on... more code please? Is it Javascript that you're using to create that warning?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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