求助:简单问题,怎样获得一个点击事件?
<a href= "test.aspx " target= "right "> 工作安排 </a>
点击 “工作安排” 就会相应一个类似button的事件
protected void Button1_Click(object sender, EventArgs e)
{
string sss = " select sum(cast(c.ischeck as tinyint))as summ ,count (*) as countt from roleright a inner join RoleRight b ON A.Funname = '学员编班 ' AND b.FunListType = A.FunId inner join usertypefun c on c.funid = a.funid and c.usertype = ' " + Session[ "branch "].ToString()+ " ' ";
OleDbConnection Connection1 = DBClass.Conn();
Connection1.Open();
OleDbCommand mycommand = new OleDbCommand(sss, Connection1);
OleDbDataReader myreader = mycommand.ExecuteReader();
if (myreader.Read())
{
Session[ "summ "] = myreader[ "summ "];
Session[ "countt "] = myreader[ "countt "];
Page.Response.Redirect( "test.aspx ");
}
}
------解决方案--------------------为什么不用 <asp:LinkButton
-------------------------------------------
MSN:bdbox@hotmail.com
请给我与您交流的机会
------解决方案-------------------- <a href= "test.aspx " target= "right "> 工作安排 </a>
因为它不是服务器端控件 ,同样它的点击事件也不会传入到后台
只能和JS交互
------解决方案-------------------- <a href= "test.aspx " target= "right " onclick= "__doPostBack(this, ' ') "> 工作安排 </a>
------解决方案--------------------不知道lz说的为了统一是什么意思?
实在要变通的话 <a> 连接到一个新页面,在page_load事件中执行操作.
也可以判断权限,不行就
alert( '不具有此权限 ');history.back()