查了半天也没能查到正确的方法。。。
那位帮下忙。。。。
------解决方案--------------------------------------------------------
you need to go through each item
foreach (ListItem li in YourListBox.Items)
{
if (li.Selected)
....
}
or
string[] s = Request.Form.GetValues(YourListBox.UniqueID);
------解决方案--------------------------------------------------------
同上
------解决方案--------------------------------------------------------
string[] s = Request.Form.GetValues(YourListBox.UniqueID);可能有问题,没有测试
------解决方案--------------------------------------------------------
服务器控件ListBox:
this.ListBox1.selectitem.text;
HTML控件;
function getText()
{
document.getElementById( "select1 ")
------解决方案--------------------------------------------------------
服务器控件ListBox:
this.ListBox1.selectitem.text;
HTML控件;
function getText()
{
var select1=document.getElementById( "select1 ");
alert(select1options[select1selectedIndex].text);
}
刚刚没写完,BOSS来了
------解决方案--------------------------------------------------------
alert(select1options[select1.selectedIndex].text);
------解决方案--------------------------------------------------------
TextBox1.Text = ListBox1.SelectedItem.Text;
TextBox2.Text = ListBox1.SelectedItem.Value;
上面的代码放到一个按钮的单击事件中,首先你的ListBox中要有项可供选择
------解决方案--------------------------------------------------------
为什么我可以啊,你是不是用的服务器控件ListBox,在SelectedIndexChanged事件中写的代码?AUTOPOSTBACK属性有没有改为TRUE
------解决方案--------------------------------------------------------
晕了,给你搞迷糊了,你没数据你怎么选择呢?