Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Probably this is an ignorance of Async postbacks, so let me lob a softball out there.

I have three cascading dropdowns in an updatepanel, using these you can pick your Store->Department->Product. A fourth DDL sits outside the updatepanel, and using this you pick your competitor. Different stores match with different competitors. A gridview (also outside) then displays the join of Store->Department->Product->Competitor Price.

This works fine when you first load and if you switch to a different store that has the same competitor. But if you change the updatepanel DDLs to a store that does not share the chosen competitor and click "Display" (causing a PostBack), I get an "Invalid Postback or callback argument." If I remove the Competitor DDL and hardcode the gridview's competitor, the error goes away and I can navigate with abandon.

Why won't that fourth DDL repopulate on postback? How do I fix this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
176 views
Welcome To Ask or Share your Answers For Others

1 Answer

The reason is that in the latter case on change of Store->Department->Product if you are rebinding the Competitior DropDownlist then ListItems will change on the server but will not be rendered to the client because it is not inside any updatepanel and thus the Competitior DropDownlist has old values in it.

when the Postback occurs ASP.Net will not understand how these old values came and will throw "Invalid Postback or Callback argument" error.

Best way to solve this will be place your dropdownlist (and gridview) inside an updatepanel.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...