现在我有一个DataGrid其中有两个模板列,分别放着DropDownList与Label,我想当该触发DropDownList的选择时,Label的Text也随着改变。
请问我该怎么实现?
请问我该怎么实现?
解决方案 »
- 哥怒了,找个真正能用的批量GBK转utf8编码转换器就这么难?
- 还是不会封装Dll
- 有一个ORM反射的问题,求解决!
- 我开发一个asp.net项目,在2005上正常,但配置到IIS上,用localhost/aaa/default.aspx就报web.config 一堆错,怎解?
- 模板列中放了两个控件,怎样调用这两个控件
- mvc4 组合查询问题
- .net mvc 怎么连接到新创建的视图页面
- key value 赋值
- 如何绑定数据到Image控件?
- 哪有C#版的水晶报表下载??送分啊...................
- 在线等:可能是无意间导致的一个关于vs .net 2005 IDE的一个小问题
- 这两种参数声明方式有什么区别?
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate> <asp:DropDownList id="DropDownList1" runat="server"
AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label1" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>page.aspx.cs:(注意public)
public void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) {
((Label)this.DataGrid1.FindControl("Label1")).ID
= ((DropDownList)sender).SelectedValue;//sender不对就用FindControl
}不知道你是在客户端改变还是在服务器端改变,客户端就简单了
无非就是document.getElementById()
我是想当DropDownList的值改变时,从数据库读取数据,并显示在Label控件中。
如:DropDownList中的选项是学生的姓名/ID,我需要选择不同的学生时在Label中显示对应的联系方式。
}