JS触发服务器控件的单击事件

<script src="../Js/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#a_doClick").click(function () {
                $("#<%=btnTest.ClientID%>").click();
            })
        })
    </script>

  

<a id="a_doClick">触发Button的Click事件</a>
<asp:Button runat="server" ID="btnTest" Text="测试js触发事件" OnClick="btnTest_Click" />

  

 protected void btnTest_Click(object sender, EventArgs e)
        {
           Response.Redirect("http://www.baidu.com");
        }

  最主要的是<%=btnTest.ClientID%>

原文地址:https://www.cnblogs.com/babietongtianta/p/4699489.html