下拉列表多选问题 [英] dropdownlist multiple selection problem
本文介绍了下拉列表多选问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将下拉列表绑定到数据源后,我遇到此错误
无法在下拉列表中选择多个项目使用代码后:
dropdownlist.items.findbyvalue(" value")。selected = true
在绑定到<期间,我没有在下拉列表中指定任何选定的项目br />
数据源。我使用dropdownlist.clearselection()但仍然发生错误。
我需要有关此信息。谢谢。
广告
after binding the dropdownlist to a datasource, ive experience this error
"Cannot have multiple items selected in a dropdownlist" after using the code:
dropdownlist.items.findbyvalue("value").selected = true
I didnt specify any selected item in the dropdownlist during binding to the
datasource. I use dropdownlist.clearselection() but still error occurs.
I need information on this. Thanks.
Ads
推荐答案
我们能否看到您的完整代码?我对ClearSelection不熟悉(不要因为某些原因,现在在文档中看到它是什么?)
Karl >
-
http://www.openmymind.net/
" ads" < ad*@discussions.microsoft.com>在留言中写道
新闻:BC ********************************** @ microsof t.com ...
Can we see your complete code? I''m not familiar with ClearSelection (don''t
see it in the docs right now for some reason??)
Karl
--
http://www.openmymind.net/
"ads" <ad*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
在将下拉列表绑定到数据源之后,我遇到了这个错误
不能在下拉列表中选择多个项目。使用
代码后:
dropdownlist.items.findbyvalue(" value")。selected = true
在绑定到
时,我没有在下拉列表中指定任何选定的项目。数据源。我使用dropdownlist.clearselection()但仍然发生错误。
我需要有关此信息。谢谢。
广告
after binding the dropdownlist to a datasource, ive experience this error
"Cannot have multiple items selected in a dropdownlist" after using the
code:
dropdownlist.items.findbyvalue("value").selected = true
I didnt specify any selected item in the dropdownlist during binding to
the
datasource. I use dropdownlist.clearselection() but still error occurs.
I need information on this. Thanks.
Ads
//在页面加载时构建2个下拉列表的数据源
if(!ispostback)
{
for(int i = DateTime.Now.Year; i> DateTime.Now.Year - 50; i- - )
{
ListItem li = new ListItem(i.ToString(),i.ToString());
ddlYrJoined.Items。添加(li);
ddlYrLeft.Items.Add(li);
}
ddlYrLeft.Items.Insert(0 ,SELECT";
ddlYrJoined.Items.Insert(0," SELECT");
}
//在一个单独的函数上
ddlYrJoined.Items.FindByValue(dr [" yrstart"]。ToString())。Selected = true;
//其中dr [" yrstart"]。ToString()是一个datareader,从
数据库获取其值
" Karl Seguin [MVP] QUOT;写道:
//build the datasource of the 2 dropdownlists on page load
if(!ispostback)
{
for (int i = DateTime.Now.Year; i > DateTime.Now.Year - 50; i--)
{
ListItem li = new ListItem(i.ToString(), i.ToString());
ddlYrJoined.Items.Add(li);
ddlYrLeft.Items.Add(li);
}
ddlYrLeft.Items.Insert(0, "SELECT");
ddlYrJoined.Items.Insert(0,"SELECT");
}
//on a separate function
ddlYrJoined.Items.FindByValue(dr["yrstart"].ToString()).Selected = true;
//where dr["yrstart"].ToString() is a datareader getting its values from a
database
"Karl Seguin [MVP]" wrote:
我们能看到你的完整代码吗?我不熟悉ClearSelection(由于某些原因,现在没有在文档中看到它?)
Karl
-
< a rel =nofollowhref =http://www.openmymind.net/target =_ blank> http://www.openmymind.net/
"广告] < ad*@discussions.microsoft.com>在消息中写道
新闻:BC ********************************** @ microsof t.com。 ..
Can we see your complete code? I''m not familiar with ClearSelection (don''t
see it in the docs right now for some reason??)
Karl
--
http://www.openmymind.net/
"ads" <ad*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
在将下拉列表绑定到数据源之后,我遇到了这个错误
不能在下拉列表中选择多个项目。使用
代码后:
dropdownlist.items.findbyvalue(" value")。selected = true
在绑定到
时,我没有在下拉列表中指定任何选定的项目。数据源。我使用dropdownlist.clearselection()但仍然发生错误。
我需要有关此信息。谢谢。
广告
after binding the dropdownlist to a datasource, ive experience this error
"Cannot have multiple items selected in a dropdownlist" after using the
code:
dropdownlist.items.findbyvalue("value").selected = true
I didnt specify any selected item in the dropdownlist during binding to
the
datasource. I use dropdownlist.clearselection() but still error occurs.
I need information on this. Thanks.
Ads
在!ispostback时还调用了单独的函数吗?你还提到了
提到了ClearSelection()但是我什么都没看到..
KArl
-
http://www.openmymind.net/
" ads" < ad*@discussions.microsoft.com>在留言中写道
新闻:3C ********************************** @ microsof t.com ...
Is the separate function also called when !ispostback? You had also
mentioned ClearSelection() but I don''t see that anywhere..
KArl
--
http://www.openmymind.net/
"ads" <ad*@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
//在页面加载时构建2个下拉列表的数据源
if(!ispostback)
for( int i = DateTime.Now.Year; i> DateTime.Now.Year - 50; i--)
{ListOtem li = new ListItem(i.ToString(),i.ToString() );
ddlYrJoined.Items.Add(li);
ddlYrLeft.Items.Add(li);
}
ddlYrLeft.Items.Insert(0," ; SELECT");
ddlYrJoined.Items.Insert(0," SELECT");
}
//在单独的函数上
ddlYrJoined.Items.FindByValue(dr [" yrstart"]。ToString())。Selected = true;
//其中dr [" yrstart"]。ToString()是一个获取它的数据引导器来自
数据库的价值
Karl Seguin [MVP]"写道:
//build the datasource of the 2 dropdownlists on page load
if(!ispostback)
{
for (int i = DateTime.Now.Year; i > DateTime.Now.Year - 50; i--)
{
ListItem li = new ListItem(i.ToString(), i.ToString());
ddlYrJoined.Items.Add(li);
ddlYrLeft.Items.Add(li);
}
ddlYrLeft.Items.Insert(0, "SELECT");
ddlYrJoined.Items.Insert(0,"SELECT");
}
//on a separate function
ddlYrJoined.Items.FindByValue(dr["yrstart"].ToString()).Selected = true;
//where dr["yrstart"].ToString() is a datareader getting its values from a
database
"Karl Seguin [MVP]" wrote:
我们能看到你的完整代码吗?我不熟悉ClearSelection
(由于某种原因,现在不在文档中看到它?)
Karl
-
http://www.openmymind.net/
" ads" < ad*@discussions.microsoft.com>在消息中写道
新闻:BC ********************************** @ microsof t.com。 ..
Can we see your complete code? I''m not familiar with ClearSelection
(don''t
see it in the docs right now for some reason??)
Karl
--
http://www.openmymind.net/
"ads" <ad*@discussions.microsoft.com> wrote in message
news:BC**********************************@microsof t.com...
>
>在将下拉列表绑定到数据源之后,我体验了这个
>错误
> 不能在下拉列表中选择多个项目使用
>之后代码:
> dropdownlist.items.findbyvalue(" value")。selected = true
>在绑定到
>期间,我没有在下拉列表中指定任何选定的项目。
>数据源。我使用dropdownlist.clearselection()但仍然发生错误。
>
>我需要有关此的信息。谢谢。
>
>广告
>
> after binding the dropdownlist to a datasource, ive experience this
> error
> "Cannot have multiple items selected in a dropdownlist" after using the
> code:
> dropdownlist.items.findbyvalue("value").selected = true
> I didnt specify any selected item in the dropdownlist during binding to
> the
> datasource. I use dropdownlist.clearselection() but still error occurs.
>
> I need information on this. Thanks.
>
> Ads
这篇关于下拉列表多选问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文