dev的lookupedit怎么清空选择?

7年 2014-12-16 02:19:14
lookupedit绑定数据后,选择以后。怎么点击按钮使lookupedit回到初始位置,即nulltext的值。注意,是点击按钮,不是按默认的CTRL+DELETE。
...全文
930 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
7年 2014-12-18
  • 打赏
  • 举报
回复
不用循环了,直接写死算了。
software_artisan 2014-12-17
  • 打赏
  • 举报
回复
Lookupedit的属性里面可以添加按钮,在按钮点击事件里写Lookupedit.EditValue = null;
exception92 2014-12-16
  • 打赏
  • 举报
回复
引用 5 楼 zzflover 的回复:

            txtKHXX.EditValue = null;
            txtKHXX.ItemIndex = -1;
            txtWAFL.EditValue = null;
            txtWAFL.ItemIndex = -1;
            txtYWLX.EditValue = null;
            txtYWLX.ItemIndex = -1;
这么写,一点问题没有,但是我在前面加上

            foreach (Control ctr in xtraScrollableControl1.Controls)
            {
                //清空textedit
                if (ctr is TextEdit)
                {
                    ctr.Text = "";
                }
                //清空dateedit
                if (ctr is DateEdit)
                {
                    ctr.Text = "";
                }
                //清空comboboxedit
                if (ctr is ComboBoxEdit)
                {
                    ComboBoxEdit cbe = (ComboBoxEdit)ctr;
                    cbe.SelectedIndex = 0;
                }
            }
这样就出现刚才我发的图的问题,奇怪。。。。。
foreach 代码中并没有 Lookupedit的转换呀,再重新检查代码,看看是不是别的地方设置了。
7年 2014-12-16
  • 打赏
  • 举报
回复
cbe是comboboxedit啊,跟lookupedit有关系?
exception92 2014-12-16
  • 打赏
  • 举报
回复
cbe.SelectedIndex 它应该等于-1吧?
7年 2014-12-16
  • 打赏
  • 举报
回复

            txtKHXX.EditValue = null;
            txtKHXX.ItemIndex = -1;
            txtWAFL.EditValue = null;
            txtWAFL.ItemIndex = -1;
            txtYWLX.EditValue = null;
            txtYWLX.ItemIndex = -1;
这么写,一点问题没有,但是我在前面加上

            foreach (Control ctr in xtraScrollableControl1.Controls)
            {
                //清空textedit
                if (ctr is TextEdit)
                {
                    ctr.Text = "";
                }
                //清空dateedit
                if (ctr is DateEdit)
                {
                    ctr.Text = "";
                }
                //清空comboboxedit
                if (ctr is ComboBoxEdit)
                {
                    ComboBoxEdit cbe = (ComboBoxEdit)ctr;
                    cbe.SelectedIndex = 0;
                }
            }
这样就出现刚才我发的图的问题,奇怪。。。。。
exception92 2014-12-16
  • 打赏
  • 举报
回复
引用 3 楼 zzflover 的回复:
editvalue赋值为null或者itemindex=-1 点击重置按钮以后,是这样的。。。。
重置 只显示nulltext的值 而不弹出下拉框??
7年 2014-12-16
  • 打赏
  • 举报
回复

editvalue赋值为null或者itemindex=-1
点击重置按钮以后,是这样的。。。。
7年 2014-12-16
  • 打赏
  • 举报
回复
editvalue赋值为null,显示为nulltext的值了,但是下拉列表跟着也出来了 itemindex=-1也试过了
exception92 2014-12-16
  • 打赏
  • 举报
回复
点击按钮 给它的EditValue=nulltext 不可以吗?

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧