首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

简单有关问题,怎样获得一个点击事件

2012-01-03 
求助:简单问题,怎样获得一个点击事件?ahref test.aspx target right 工作安排 /a点击“工作安排

求助:简单问题,怎样获得一个点击事件?
<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()

热点排行