Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.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# 添加html时,服务器标记的格式不正确_C#_Jquery_Asp.net - Fatal编程技术网

C# 添加html时,服务器标记的格式不正确

C# 添加html时,服务器标记的格式不正确,c#,jquery,asp.net,C#,Jquery,Asp.net,我在尝试运行要在服务器端访问的jQuery代码段时出错。错误出现在var html上 错误是: 分析器错误消息:服务器标记的格式不正确 $(“添加组”)。单击(功能(e){ var html='Save; $(html).insertBefore($(“.sortable:first”); }); 有人知道如何解决这个问题吗?您不能用javascript创建服务器标记。您可以使用asp.net在服务器端创建标记,使用javascript/jQuery隐藏标记,或者将其样式设置为在服务器端显示:

我在尝试运行要在服务器端访问的jQuery代码段时出错。错误出现在var html上

错误是:

分析器错误消息:服务器标记的格式不正确

$(“添加组”)。单击(功能(e){
var html='Save
    ; $(html).insertBefore($(“.sortable:first”); });
    有人知道如何解决这个问题吗?

    您不能用javascript创建服务器标记。您可以使用asp.net在服务器端创建标记,使用
    javascript/jQuery
    隐藏标记,或者将其
    样式设置为
    在服务器端显示:无
    ,并在客户端和服务器端访问标记

    Asp.net服务器控件

    
    

    
    
    Javascript

    $(“添加组”)。单击(功能(e){
    var textbox1=$(“#”);
    textbox1.insertBefore($(“.sortable:first”);
    textbox1.show();
    });
    
     $("#add_group").click(function (e) {
                    var html = '<input id=\"newGroup\" placeholder=\"Group Name\" runat=\"server\" ><button id=\"Save_Group\" type=\"button\" runat=\"server\" onserverclick=\"saveGroupClick_Handler\" >Save</button><ul class=\"sortable\"></ul>';
                    $(html).insertBefore($(".sortable:first"));
    
                });
    
    <asp:TextBox id="textbox1" runat="server" style="display:none" ></asp:TextBox>
    
    <input type="text" id="textbox1" runat="server" style="display:none" />
    
    $("#add_group").click(function (e) {
        var textbox1 = $('#<%= textbox1.ClientID %>');
        textbox1.insertBefore($(".sortable:first"));
        textbox1.show();
    });