重新填充下拉一个UpdatePanel外 [英] Repopulating a dropdown outside an updatepanel

查看:109
本文介绍了重新填充下拉一个UpdatePanel外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许这是异步回发的无知,所以让我吊射一个垒球在那里。

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

我有三个级联的下拉列表中一个UpdatePanel,使用这些你可以选择你Store->部 - >产品。第四DDL坐在外面的UpdatePanel,并使用此你挑你的竞争对手。不同的商店搭配不同的竞争对手。一个GridView(外还),然后显示加入Store-的>部 - >产品展示 - >竞争对手的价格。

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.

这工作得很好,当你第一次加载,如果你切换到不同的商店具有相同的竞争者。但是,如果你改变的UpdatePanel的DDL到不共享选择竞争对手,然后单击显示(导致回发)一个商店,我得到一个无效的回发或回调参数。如果我删除竞争对手DDL和硬code GridView的竞争对手,错误消失,我可以尽情浏览。

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.

为什么不就是第四DDL重新填充在回发?我该如何解决这个问题?

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

推荐答案

的原因是,在上Store->部 - >产品的变化的后一种情况下,如果你重新绑定出现的同类DROPDOWNLIST然后ListItems的将改变在服务器上,但将不被呈现给客户端,因为它不是任何UpdatePanel内并且因此出现的同类DROPDOWNLIST在它有旧值。

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.

错误。

解决这将是你的DropDownList(和GridView)将一个UpdatePanel内的最佳方式。

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

这篇关于重新填充下拉一个UpdatePanel外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆