我想得到listbox的选中值(selectvalue),应该怎么写!我在selectindexchange中写i= listbox.selectvalue 得到的是空值!给个例子!谢谢大侠!
解决方案 »
- 在Asp.net页面添加一个<button onclick='window.location="aa.aspx">会自动PostBack,怎样禁止
- 散分分享生产静态页面的三种方式
- 滑动门中gridview控件换页的问题
- 服务器端取得style(在线求解!!)
- 关于datagrid绑定、刷新的问题
- 怎样保持密码文本框的状态值
- 为什么我的 net每次启动都要提示
- DataTable导出Excel
- 开发网页,想学点画图的本领,学什么好呢?PHOTOSHOP还是FIREWORKS??
- 关于用户控件的一个问题
- listbox的这样功能怎么实现?
- 中小企业应用用什么php4、php5、asp.net、or asp
试试
string str=ListBox.SelectedItem.Text;
如果想得到VALUE值,
string str=ListBox.SelectedItem.Value;
==>
listbox1.SelectedItem <> nothing
{
bool ExistSign = false;
if(this.LBoxSource.Items[SourceCount].Selected == true)
{
for(int TargetCount = 0; TargetCount < this.LBoxTarget.Items.Count; TargetCount++)
{
if(this.LBoxTarget.Items[TargetCount].Text == this.LBoxSource.Items[SourceCount].Text)
{
ExistSign = true;
break;
}
}
if(ExistSign == false)
{
this.LBoxTarget.Items.Add(this.LBoxSource.Items[SourceCount].Text);
}
}
}