读书人

关于一个得到用户控件中listbox值的简

发布时间: 2011-12-25 23:21:20 作者: rapoo

关于一个得到用户控件中listbox值的简单问题,都来抢分吧
一个主页面Main.aspx包含一个用户控件UC1,用户控件里有一个ListBox
问题如下:
用this.Response.Write方法在页面显示出用户控件中ListBox的选中的Text值和SelectIndex值


[解决办法]
ListItem lt = new ListItem(ListBox7.SelectedItem.Text, ListBox7.SelectedValue);
[解决办法]
this.Response.Write(((ListBox)UC1.FindControl( "ListBox1 ")).Text);
this.Response.Write(((ListBox)UC1.FindControl( "ListBox1 ")).SelectIndex);
试一下呢。手写的
[解决办法]
response.write(((ListBox)UC1.FindControl( "ListBox1 ")).SelectItem.Text);
response.write(((ListBox)UC1.FindControl( "ListBox1 ")).SelectItem.Value);

读书人网 >asp.net

热点推荐