将label.text传递到dropdownlist.selecteditem.text [英] Passing label.text into dropdownlist.selecteditem.text

查看:82
本文介绍了将label.text传递到dropdownlist.selecteditem.text的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我正在使用此代码显示来自label.text
的下拉列表中的selecteditem

Hye all..

I am using this code to display the selecteditem of the dropdownlist from the label.text

Me.ddlDefect.SelectedItem.Text = Me.lblDefect.Text


标签中的文本为:


the text in the label is:

Me.lblDefect.Text = "DAKON"



这是出现在我的下拉列表中的ddlDefect项:

DAKON(作为选定项)
ANA ARAI
达康
达康/凹痕
DAN
DAN AT ASSY PTS
丹·迪亚(DAN AT DIA). 104.8

请注意,DAKON出现了两次;首先是选定项,另一个是下拉列表项.

我要显示的项目仅是下拉列表项,而selecteditem是DAKON,而不是将DAKON项目添加到下拉列表中的第一项.

我该怎么做?



This is the ddlDefect items that appears in my dropdownlist:

DAKON(as the selecteditem)
ANA ARAI
DAKON
DAKON/DENTED
DAN
DAN AT ASSY PTS
DAN AT DIA. 104.8

Note that DAKON appears two times; first as the selecteditem n the other one as the dropdownlist items.

The items that I want to display is only dropdownlist items and the selecteditem is DAKON, not adding the DAKON item to the first item in dropdownlist.

How can I do that?

推荐答案

试试看:
ddlDefect.SelectedValue = lblDefect.Text;


这篇关于将label.text传递到dropdownlist.selecteditem.text的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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