问题描述
我在sql数据库中有一个值为Additional Work的字段。但是我无法将值检索到下拉列表。没有空间,它正在接受。如何用空格接受值.....
i have a field with value "Additional Work" in sql database. But im not able to retrieve the value to dropdownlist. Without spaces it''s accepting. how to accept the value with spaces.....
推荐答案
txtclass.SelectedValue = (objDataSet.Tables[0].Rows[0]["Class"]).ToString();
,假设txtclass实际上是一个下拉列表。你能检查一下列表的开头或结尾是否有流氓空格?值应为< asp:ListItem> Anglo Indian< / asp:ListItem> ;.
您尝试选择.SelectedValue ='的任何项目必须已经在列表中且必须是标签之间字符串的完全匹配
, assuming that txtclass is actually a dropdownlist. Can you check that there are no rogue white spaces at the beginning or end of the list? The values should read <asp:ListItem>Anglo Indian</asp:ListItem>.
Any item you try to select with ''.SelectedValue = '' must already be in the list and must be an exact match of the string between the tags
这篇关于如何从sql到dropdownlist获取带空格的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!