Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# jquery在使用时不工作<;表格>;标签_C#_Jquery_Asp.net - Fatal编程技术网

C# jquery在使用时不工作<;表格>;标签

C# jquery在使用时不工作<;表格>;标签,c#,jquery,asp.net,C#,Jquery,Asp.net,当我在asp.net控件中使用表单标记时,Jquery没有工作。那么解决方案是什么呢?我尝试了多种技术,但都不起作用 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat=

当我在asp.net控件中使用表单标记时,Jquery没有工作。那么解决方案是什么呢?我尝试了多种技术,但都不起作用

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#bt1").click(function () {
                $("#p1").hide(2000);
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <p runat="server" id="p1">this is asp.net</p>
        <asp:Button ID="bt1" Text="click" runat="server"/>
    </div>
        </form>
</body>
</html>

$(文档).ready(函数(){
$(“#bt1”)。单击(函数(){
$(“#p1”).hide(2000年);
});
});

这是asp.net


当您使用ASP.NET时,
bt1
是您需要使用的服务器控件

将获取由ASP.NET生成的HTML标记的控件ID

使用

$(“#”)点击(函数(){
$(“#”)隐藏(2000);
});


您可以使用模式,然后可以继续使用现有代码。但是我不推荐它。

你能看看生成的html吗。。。。同时检查浏览器控制台,查看是否存在任何错误,`runat=“server”`do?runat=“server”表示元素在服务器端运行。请提取生成的HTML并将其作为问题的更新发布。删除表单时是否有效?@soravSingh,是否使用了
$(“#”)。单击(函数(){$(“#”)。隐藏(2000););
$("#<%= bt1.ClientID %>").click(function () {
    $("#<%= p1.ClientID %>").hide(2000);
});