0

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?

MrSmith42
  • 9,961
  • 6
  • 38
  • 49
aggietech
  • 978
  • 3
  • 16
  • 38

1 Answers1

1

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?

David Archer
  • 2,008
  • 4
  • 26
  • 31
  • Well - i'm working on an entry form, so there are multiple text boxes and drop down list, etc. And those are all encapsulated in different UpdatePanels. Otherwise it's a pretty straight forward page. – aggietech Nov 10 '10 at 22:34
  • What are you using for the "You are about to leave this page" alert(?) Javascript? – David Archer Nov 10 '10 at 22:35
  • That's my question, i didn't write it. It's a prompt from the browser – aggietech Nov 10 '10 at 22:36
  • Now that's even more strange. I've used ASP.Net AJAX loads and never had that problem, unfortunately. It sounds like you may have a browser issue. Which browser are you using, and do you have any plugins installed, like iGoogle? – David Archer Nov 10 '10 at 22:39
  • OK, first thing to do is try it in another browser, see if it's IE only. If not, the chances are you're probably still loading stuff in. Try having just one update panel for the entire page, that should help. – David Archer Nov 10 '10 at 22:43
  • Also found this while researching: – David Archer Nov 10 '10 at 22:47
  • http://stackoverflow.com/questions/72541/one-update-panel-vs-multiple-update-panels - "I'd caution that with multiple update panels you'll want to be careful. Make sure you set the UpdateMode to Conditional. Otherwise, when one update panel is "posted back" to the server, all of them are posted back." – David Archer Nov 10 '10 at 22:48