客户端js服务端互相调用

来源:互联网 发布:人员职务数据库设计 编辑:程序博客网 时间:2024/06/06 06:47

<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
    //要写在head内

    function ConfirmAddEquipment()
    {
        if(confirm('调用吗?'))

            __doPostBack('CreateDir',   '');

    }  
    </script>   
</head>           

 

 <asp:LinkButton   ID="CreateDir"   runat="server"   OnClick="CreateDir_Click"   />  

           

 

                string s = "<script language=javascript>ConfirmAddEquipment();</script>";
                ClientScriptManager cs = Page.ClientScript;
                Type cstype = this.GetType();
                cs.RegisterStartupScript(cstype, "ConfirmAddEquipment", s);//在</from>前执行