回发后,dropdownlist不显示任何值

编程入门 行业动态 更新时间:2024-10-26 20:32:40
本文介绍了回发后,dropdownlist不显示任何值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我有一个使用webforms的网络应用程序,我在Formview中有两个下拉列表。 我根据选择来填充一个下拉列表其他。只要没有发生回发,我就会看到列表正确填充但在回发后,我的下拉列表是空的。 我正在设置我在运行时填充的ddl的DataValueField属性该ddl的ViewStateMode设置为Enabled。 有谁知道原因是什么? 非常感谢。

Hi everyone, I have a web application using webforms and I have two dropdown lists inside a Formview. I am populating one dropdownlist based on the selection from the other. As long as there is no postback happening, I see the list getting populated correctly but after a postback, my dropdownlist is empty. I am setting the DataValueField property of the ddl that I populate at runtime and the ViewStateMode for that ddl is set to Enabled. Does anyone know what could be the reason? Thanks much.

推荐答案

我强烈怀疑你在Page_Load事件中绑定了DropDownList。如果是这样,请按如下所示: I strongly suspect you binded your DropDownList in Page_Load event. If so,put it as follows: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //bind dropdown here } }

问候......

你指的是基于我填充其他ddl的ddl吗?我在if(!postback)中绑定了那个,但是另一个没有绑定。 我注意到在运行时填充的文本框的内容也会在回发后消失。 我将ddl移到了Formview之外,现在它在回发后保留了它的内容。 Formview中控件的具体内容在运行时填充,我怎么能让它们在回发后保留它们的值? 谢谢。 Are you referring to the ddl based on which I am populating the other ddl? I do bind that one in if(!postback) but the other one is not bound at all. I noticed that the contents of a text box that is filled at runtime also disappear after postback. I moved the ddl outside of the Formview and now it retains its contents after postback. What is specific about controls inside a Formview that are filled at runtime and how can I make them retain their values after postback? Thanks.

更多推荐

回发后,dropdownlist不显示任何值

本文发布于:2023-10-12 21:12:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1485911.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回发后   dropdownlist

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!