【发布时间】:2013-01-25 06:45:51
【问题描述】:
我有下拉列表和一个文本框。
我正在从下拉列表中选择一个项目,并在选择时从下拉列表中选择的文本显示在文本框中。
我在这里遇到如下问题:
下拉列表中填充的文本之一是:
SUNROOF, POWER, TILT-SLIDING, ELECTRIC with express-open and wind deflector -Includes (CJ2) Air conditioning, dual-zone, automatic. -Includes (ZM9) Universal Transmitter)
But when this is selected and the same text shown in textbox, the text is becoming as below .. i.e losing a space, and this is causing a problem.
SUNROOF, POWER, TILT-SLIDING, ELECTRIC with express-open and wind deflector -Includes (CJ2) Air conditioning, dual-zone, automatic. -Includes (ZM9) Universal Transmitter)
注意:下拉列表中的“自动。[此处的 2 个空格]-包含”和文本框中的“自动。[此处的 1 个空格]-包含”。即少一个空格。
文本被加载到下拉列表中,如下所示:
ddlEngine.Items.Add(new ListItem(Engine[i][0], Engine[i][1]));
这里引擎[i][0] = TEXT
Engine[i][1] = 用于差异目的的整数值..
并且在下拉列表值更改时...文本被复制到文本框中,如下所示:
document.getElementById("engineText").value = document.getElementById("ddlEngine").options[document.getElementById("ddlEngine").selectedIndex].text;
我需要这两个值相同。 知道为什么会这样吗???以及我如何才能了解这种行为。
【问题讨论】:
-
您为什么要尝试在下拉列表中填充那么多以 James.. 开头的文本?
-
好吧,那是有道理的.. 那么下拉列表中的值在哪里或如何填充..?您是否有权访问代码,或者您可以显示它是如何加载的..?
-
@DJKRAZE .. 请查看编辑一次..我添加了所需的代码..谢谢
标签: c# asp.net .net drop-down-menu textbox