简体   繁体   中英

Update Panel doesn't refresh content

Problem:

I'm having problems with an UpdatePanel not refreshing its contents.

I have a web page with dropdown lists that cascade their selections such that selecting a value in one filters the available options in the next.

My page is structured like this:

  • DropDownList1
  • UpdatePanel1 ( DropDownList2 )
  • UpdatePanel2 ( DropDownList3 )

When the user makes a selection in DDL1, it filters the options in DDL2 and DDL3. this works

When the user makes a selection in DDL2, it should filter the remaining options in DDL3. does not work

What I've Tried:

I have several breakpoints set and I know that the update method for DDL3 is being called.

If i remove UpdatePanel2, the contents of DDL3 get updated as expected, but the whole page refreshes and scrolls back to the top.

UpdatePanel2 has an AsyncPostBackTrigger pointing to DDL2. If I change that to a PostBackTrigger DDL3 correctly updates but the whole page refreshes and scrolls back to the top.

If I remove all the Triggers from UpdatePanel2, then DDL3 correctly updates but the whole page refreshes and scrolls back to the top.

Help:

I don't know what else to try.

I fixed my problem.

For whatever reason, the event handler wasn't getting set correctly. In the page init, I manually assigned the event handler and everything is working now.

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

    AddHandler ddlSecond.SelectedIndexChanged, AddressOf ddlSecond_SelectedIndexChanged

End Sub

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