切换到ASP.NET 3.5,DropDownList的不记得动态添加的项目 [英] Switched to ASP.NET 3.5, DropDownList doesn't remember dynamically added items

查看:134
本文介绍了切换到ASP.NET 3.5,DropDownList的不记得动态添加的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用一对夫妇DropDownLists是数据绑定的站点。我也做的,如果传统(的IsPostBack!){list.Databind();}并依靠视图状态保持回发时填写的名单。我最近转换现场ASP.NET 3.5,发现名单回发期间是空的(如果ViewState是禁用的)。我没有明确禁止任何东西,如果有人已经看到了在他们的视图状态取决于控制的类似变化或行为很纳闷。

I have a site that uses a couple DropDownLists that are databound. I was also doing the traditional if (!IsPostBack) {list.Databind();} and relied on viewstate to keep the lists filled during a post back. I recently converted the site to ASP.NET 3.5 and noticed that the lists are empty during postback (as if ViewState is disabled). I didn't explicitly disable anything, and am wondering if anyone has seen a similar change or behavior in their viewstate dependent controls.

谢谢!

詹姆斯

推荐答案

我肯定见过类似的问题(虽然雷人,能见度)。尽量确保ViewState是明确对整个控制层级启用到下拉。

I have definitely seen similar problems (though mine were with visibility). Try to ensure that the ViewState is explicitly enabled on the whole control hierarchy down to the dropdown.

例如

‹asp:Page EnableViewState="True" ...›
     ...

     ‹asp:Panel EnableViewState="True"...›
         ...
         ‹asp:DropDownList EnableViewState="True" ...›
         ...
      ...
...

R上。

这篇关于切换到ASP.NET 3.5,DropDownList的不记得动态添加的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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