/**/
<asp:DropDownList ID="dropdownlist" runat="server" AutoPostBack="True" OnSelectedIndexChanged="selectchanged">
</asp:DropDownList>
//绑定
dropdownlist.DataSource = ds.Tables[0];
dropdownlist.DataTextField = "name";
dropdownlist.DataValueField = "id";
dropdownlist.DataBind();
protected void selectchanged(object sender, EventArgs e)
{
//在这个地方取dropdownlist.SelectedIndex总是0,求解;
}
解决方案 »
- 搜索一个关键字,然后找到属于百度快照的网站,用程序怎么实现??
- 大家帮忙看下传图片发生 GDI+ 中发生一般性错误
- 按比例缩放代码有点问题,帮忙看看
- bs树中如何实现连动选择
- 感觉程序的写法出了点问题,不知道那位高人能给指点下。
- 请问,如何让RegularExpressionValidator验证一个文本框出错后弹出alert('***')。
- 新手请教:如何将table里表格内容取数据库里的字段 来居左或居右
- 关于验证控件不能触发事件的讨论
- 怎么在后发读取confirm()的值?
- 从未碰到过的问题。。。。急!。。在线等。。。
- 关于“Microsoft.Office.Interop.Excel.dll”的警告
- WebChart控件怎么安装与使用
protected void selectchanged(object sender, EventArgs e)
{
//在这个地方取dropdownlist.SelectedIndex总是0,求解;
}
不是这个事件、你选择错事件了!SelectIndexchanged
说2楼对的,你们应该没有看完我的帖子吧.
函数名称无所谓的,事件应该也是OnSelectedIndexChanged.
都没有问题.
dropdownlist的数据我是用datasource绑定的.
如果不绑定,直接写在aspx页面写死itemlist的话dropdownlist.SelectedIndex的值是会随选择而改变的.