现在我有一个 DropDownList 还有一个CheckBox cb1 <asp:DropDownList ID="ddl1" runat="server" ForeColor="Red" Width="150px">
<asp:ListItem>-请选择-</asp:ListItem>
<asp:ListItem Value="a">我要让cb呈选择状态</asp:ListItem>
</asp:DropDownList>
比如我在页面中选择了 “我要让cb呈选择状态” 那么我的CheckBos 就是选择状态的 这个怎么做???
谢谢各位
<asp:ListItem>-请选择-</asp:ListItem>
<asp:ListItem Value="a">我要让cb呈选择状态</asp:ListItem>
</asp:DropDownList>
比如我在页面中选择了 “我要让cb呈选择状态” 那么我的CheckBos 就是选择状态的 这个怎么做???
谢谢各位
解决方案 »
- 水晶报表的问题。
- 关于解析<A href="http://localhost:88/hoh4/55555555">1212</A> 急啊,谢谢
- 关于DataGridView绑定IList的问题
- ---为什么一个Thread中的方法不能调用另一个Thread中的方法?而Control.BeginInvoke中确能实现这样的调用,原因是什么?能介绍一下吗?
- net 里 加载 gif 等 动态 图片 的 方法
- 调用构造函数问题
- WINfrom的RDLC报表,如果表格中的文本框值为0,如果不显示0,而为空文本?
- c#使用客户端 实现自动向网页填写数据,验证码等,保存操作
- 很烦,很烦!!!!!!!!!!!!!!11
- 请问,如何在C#里面改变一个窗体标题的字体?
- 有关 DevExpress.XtraGrid 分组问题
- 求SQL 语句
是的话设置checkbox的状态为选择
是的话设置checkbox的状态为选择
<asp:ListItem>-请选择-</asp:ListItem>
<asp:ListItem Value="a">我要让cb呈选择状态</asp:ListItem>
</asp:DropDownList>
<script>
function changeSelect(){
document.getElementById('CheckBosid号').checked = true;
}
</script>
在DropDownList的 ItemChange 事件中写 cb1.checked = true;
就OK
如果需要反复操作或 DropDownList中Item不止两个、那么需要判断、依然在ItemChange中、判断如果当前选中为“我要让cb呈选择状态”,则cb1.checked = true; 否则 cb1.checked = false;
有好几十个条件 有NN多 CheckBox
<asp:ListItem>-请选择-</asp:ListItem>
<asp:ListItem Value="a">我要让cb1呈选择状态</asp:ListItem>
<asp:ListItem Value="a">我要让cb2呈选择状态</asp:ListItem>
</asp:DropDownList> protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
{
//判断如果选择1 就 让cb1checked = true;
//判断如果选择2 就 让cb2checked = true;
}
这样OK?
你的几十个条件和每一个checkbox的对应关系是什么,如果没有规律性可言,那只能一个个写配对如果有统一对于关系,如<asp:ListItem Value="a">对于Checkbox的id为a
<asp:ListItem Value="b">对于Checkbox的id为b
那写个通用方法就OK了
想无刷新,就按4楼写吧 ,js照样也能判断ddl选的什么
那
DropDownList 是 SelectedValue?
比如我有一个DDL2
<asp:DropDownList ID="DDL2 " runat="server">
<asp:ListItem Value="">-请选择-</asp:ListItem>
<asp:ListItem Value="Desc">降序</asp:ListItem>
<asp:ListItem Value="Asc">升序</asp:ListItem>
</asp:DropDownList>选择 ddl1 , 1的时候 cb1.checked = true; 同时 让ddl2 的 值 = ddl2.SelectedValue ="Desc" ???
<asp:ListItem>-请选择-</asp:ListItem>
<asp:ListItem Value="a">我要让cb呈选择状态</asp:ListItem>
</asp:DropDownList>
<script>
function changeSelect(){
// 没环境,需要自己测试正确性
var ddl = document.getElementById('ddl1');
var value = ddl.value ;
if (value = '1111')
{
document.getElementById('CheckBosid1').checked = true;
document.getElementById('CheckBosid2').checked = false; }
else if (value = '2222')
{
document.getElementById('CheckBosid1').checked = false;
document.getElementById('CheckBosid2').checked = true;
}
}
</script>
{
if (ddl_Rpt_TypeQ.SelectedValue == "a")
{
cb1.Checked = true;
}
}
为啥不走事件呢!!!
{
if (dd1.SelectedValue == "a")
{
cb1.Checked = true;
}
}
为啥不走事件呢!!!这样这样