请教高手关于B/S的问题怎么解决,在线等
B/S网页中 我有checkebox1,checkebox2,checkbox3,checkbox4四控件怎么样实现当我checkbox1被选中时候其它控件自动不选中状态,当2-4中任何一个被选中适合checkbox1的checked属性自动为false,我在控件的checkedchange事件中设置不可以。
------解决方案--------------------一个个的写事件就是了吧
如果只控件1的话234可以共用一个事件
------解决方案--------------------AUTOPOST设置为TRUE
------解决方案--------------------javascript 中checkbox的onclick事件
大概:
document.getElementById( "checkbox2 "/*2-4*/).checked = ! document.getElementById( "checkbox1).checked ;
其它雷同
------解决方案--------------------把checkbox的autopostback设为true,当点击的时侯就在提交到后台,在C#里做处理就行了!
------解决方案--------------------朋友..你CheckBox的属性AutoPostBack= "True "要改成这个.不知道你改了没有..
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox2.Checked = false;
CheckBox3.Checked = false;
CheckBox4.Checked = false;
}
protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
CheckBox1.Checked = false;
}
protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
{
CheckBox1.Checked = false;
}
protected void CheckBox4_CheckedChanged(object sender, EventArgs e)
{
CheckBox1.Checked = false;
}
}
------解决方案-------------------- <%@ Page Language= "C# " AutoEventWireup= "true " CodeFile= "Default2.aspx.cs " Inherits= "Default2 " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " runat= "server ">
<div>
<asp:CheckBox ID= "CheckBox1 " runat= "server " AutoPostBack= "True " OnCheckedChanged= "CheckBox1_CheckedChanged " /> <br />
<br />
<asp:CheckBox ID= "CheckBox2 " runat= "server " AutoPostBack= "True " OnCheckedChanged= "CheckBox2_CheckedChanged " /> <br />
<br />
<asp:CheckBox ID= "CheckBox3 " runat= "server " AutoPostBack= "True " OnCheckedChanged= "CheckBox3_CheckedChanged " /> <br />
<br />
<asp:CheckBox ID= "CheckBox4 " runat= "server " AutoPostBack= "True " OnCheckedChanged= "CheckBox4_CheckedChanged " /> </div>
</form>
</body>
</html>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page