Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/262.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# <;asp:TreeView>;向可通过JavaScript/JQuery访问的treenode添加附加信息?_C#_Jquery_Asp.net_Treeview - Fatal编程技术网

C# <;asp:TreeView>;向可通过JavaScript/JQuery访问的treenode添加附加信息?

C# <;asp:TreeView>;向可通过JavaScript/JQuery访问的treenode添加附加信息?,c#,jquery,asp.net,treeview,C#,Jquery,Asp.net,Treeview,有没有一种方法可以通过JavaScript/Jquery将信息添加到asp:TreeView中 我的问题是:我必须通过JQuery/Javascript(在客户端)防止asp:TreeView中的复选框在不同的子类别(或按原型前缀分组的父节点)中是可选择的。当我使用$(this.next().Text();)请求TreeNode文本时,它已经起作用了;,因为它们在类别中有一个前缀(原型),但现在我不得不隐藏这些信息,不能用它来检查 $("[id*=TreeView1] input[typ

有没有一种方法可以通过JavaScript/Jquery将信息添加到asp:TreeView中

我的问题是:我必须通过JQuery/Javascript(在客户端)防止asp:TreeView中的复选框在不同的子类别(或按原型前缀分组的父节点)中是可选择的。当我使用$(this.next().Text();)请求TreeNode文本时,它已经起作用了;,因为它们在类别中有一个前缀(原型),但现在我不得不隐藏这些信息,不能用它来检查

    $("[id*=TreeView1] input[type=checkbox]").bind("click", function () {

        var isChecked = $(this).is(":checked");

        if (isChecked) {
            zuletztSelektiert = zuletztSelektiert + $(this).next().text();
        }
        else {
            zuletztSelektiert = zuletztSelektiert.replace($(this).next().text(), '');
        }

        if (zuletztSelektiert != '') {
            // Welcher Stereotyp ist selektiert?
            var stereotype = zuletztSelektiert.substring(zuletztSelektiert.indexOf('«') + 1, zuletztSelektiert.indexOf('»'));

            $("[id*=TreeView1] input[type=checkbox]").each(function () {
                var currentStereotype = $(this).next().text().substring($(this).next().text().indexOf('«') + 1, $(this).next().text().indexOf('»'));

                if (currentStereotype != stereotype) {
                    var isChecked2 = $(this).is(":checked");

                    if (isChecked2) {
                        $(this).removeAttr("checked");
                        zuletztSelektiert = zuletztSelektiert.replace($(this).next().text(), '');

                        alert('It is not possible to select elements of different stereotypes. \n\n Selected Items:\n' + zuletztSelektiert);
                    }
                }

            });

        }
    });

好的,因为没有人知道答案,我只是通过将原型作为GET Param添加到链接目标URL并导航到树节点中的-Tag来实现

   $("[id*=TreeView1] input[type=checkbox]").bind("click", function () {

        var selectedStereoType = $.trim($(this).next().prop("href").substring($(this).next().prop("href").indexOf("=") + 1));
        //return;

        var isChecked = $(this).is(":checked");

        if (isChecked) {
            //zuletztSelektiert = zuletztSelektiert + $(this).next().text();
            zuletztSelektiert = zuletztSelektiert + selectedStereoType;
        }
        else {
            //zuletztSelektiert = zuletztSelektiert.replace($(this).next().text(), '');
            zuletztSelektiert = zuletztSelektiert.replace(selectedStereoType, '');
        }

        if (zuletztSelektiert != '') {
            // Welcher Stereotyp ist selektiert?
            //var stereotype = zuletztSelektiert.substring(zuletztSelektiert.indexOf('«') + 1, zuletztSelektiert.indexOf('»'));
            var stereotype = selectedStereoType;
            var letzteMeldung = '';

            $("[id*=TreeView1] input[type=checkbox]").each(function () {
                //var currentStereotype = $(this).next().text().substring($(this).next().text().indexOf('«') + 1, $(this).next().text().indexOf('»'));
                var currentStereotype = $.trim( $(this).next().prop("href").substring($(this).next().prop("href").indexOf("=") + 1) );

                if (currentStereotype != stereotype) {
                    var isChecked2 = $(this).is(":checked");

                    if (isChecked2) {
                        $(this).removeAttr("checked");
                        zuletztSelektiert = zuletztSelektiert.replace($.trim( $(this).next().prop("href").substring($(this).next().prop("href").indexOf("=") + 1) ), '');

                        letzteMeldung='It is not possible to select elements of different stereotypes. \n\n Selected Items: ' + zuletztSelektiert;
                    }
                }

            });

            if (letzteMeldung != '') alert(letzteMeldung);

        }
    });
这就是我在C#NET中的做法
treeNode.NavigateUrl=“URL?stereotype=“+stereotype

嗨!通过将原型添加到目标URL解决了这个问题,因为我没有找到方法。