回发时Dropdownlist不会保持价值

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

我有服务器端下拉菜单,当我单击按钮时,它无法保持回发值 请帮助

I have server side droppdown it does not keeping value on post back when i am clicking on button please help

推荐答案

您可能在Page_Load事件中将Dropdown绑定到数据库,而未选中Page.IsPostBack.试试这个 You are probably binding your Dropdown to your database in Page_Load event without checking Page.IsPostBack. Try this void Page_Load (........) { if (!this.IsPostBack) { //Data Bind Dropdown here } }

我从您的问题中了解到的是,您没有在回发后将databse值添加到下拉列表中.解决方案是您需要将数据绑定到回发中,而不是回发中. 如果对此有任何疑问,请对此发表评论. 问候, shefeek Hi, What i understand from your question is that you did''nt get the databse value in to the dropdown after a postback.The sollution is you need to bind the data in postback and in not postback. if any doubt in this please make comment on it. regards, shefeek

通过阅读此问题,您正面临这样的问题,我认为,您倾向于将项目放入下拉列表,如果那个时候发生任何回发,而您没有获得所选择的值,那么这就是您的问题所在. 用这种方式 1.添加headden提起 2.创建一个JavaScript数学方法并将dropdownlist值转换为headden字段值,然后通过使用headden filedvalue来在需要的地方(dropdownlist值)使用.. 谢谢, Naresh.G Hi, By reading this Question,you are facing the problem like this i think,you bend to items into the dropdownlist, if any post back is occurred that time you are not geting that value what you selected.if it is you problem means. use this way 1.add headden filed 2.create one javascript mathod and take dropdownlist value into headden filed value and then you use where you need that (dropdownlist value) by using headden filedvalue.. Thanks, Naresh.G

更多推荐

回发时Dropdownlist不会保持价值

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

发布评论

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

>www.elefans.com

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