Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.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# can';不要让jqueryui手风琴在回发时保持活动索引_C#_Asp.net_Jquery Ui_Postback_Accordion - Fatal编程技术网

C# can';不要让jqueryui手风琴在回发时保持活动索引

C# can';不要让jqueryui手风琴在回发时保持活动索引,c#,asp.net,jquery-ui,postback,accordion,C#,Asp.net,Jquery Ui,Postback,Accordion,我环顾四周,找到了许多解决方案,但出于某种原因,这对我来说根本不起作用 .NET 4,c# 我有一架有三节的手风琴。在我的c#代码隐藏加载部分中,我有 if (!IsPostBack) { MembershipUser websiteUser = Membership.GetUser(); ProfileCommon websiteUserProfile = Profile.GetProfile(websiteUser.UserName); if (websiteUse

我环顾四周,找到了许多解决方案,但出于某种原因,这对我来说根本不起作用

.NET 4,c#

我有一架有三节的手风琴。在我的c#代码隐藏加载部分中,我有

if (!IsPostBack)
{
    MembershipUser websiteUser = Membership.GetUser();
    ProfileCommon websiteUserProfile = Profile.GetProfile(websiteUser.UserName);

    if (websiteUserProfile.PrimaryCompany == "BEL")
        hiddenAccordionIndex.Value = "1";
}
这将设置初始活动部分。这个很好用

我现在想做的是,如果活动部分切换为0,然后页面上发生回发,我希望手风琴将活动部分保持为0

实际发生的是,手风琴正在切换回1

我的jquery

    var currentIndex = $("#<%= hiddenAccordionIndex.ClientID %>").val();
    $("#accordion").accordion({
        heightStyle: "content",
        collapsible: true,
        active: parseInt(currentIndex),
        change: function (event, ui) {
            var newIndex = $(this).children("h3").index(ui.newHeader);
            $("#<%= hiddenAccordionIndex.ClientID %>").val(newIndex);
        }
    });
var currentIndex=$(“#”)val();
$(“手风琴”)。手风琴({
高度样式:“内容”,
可折叠的:是的,
活动:parseInt(当前索引),
更改:功能(事件、用户界面){
var newIndex=$(this.children(“h3”).index(ui.newHeader);
$(“#”)val(新索引);
}
});
即使我删除了设置初始活动部分的c#代码,行为也是一样的。所以我确信这不是问题的原因

有人能提出这里可能出了什么问题吗?我被难住了

谢谢,我有答案了

更改不是一个事件。相反,我使用了激活,现在可以使用了

我看到的所有解决方案都是一个更改事件,也许这是针对旧版本的

新代码

var currentIndex = $("#<%= hiddenAccordionIndex.ClientID %>").val();
$("#accordion").accordion({
    heightStyle: "content",
    collapsible: true,
    active: parseInt(currentIndex),
    activate: function (event, ui) {
        var newIndex = $(this).children("h3").index(ui.newHeader);
        $("#<%= hiddenAccordionIndex.ClientID %>").val(newIndex);
    }
});
var currentIndex=$(“#”)val();
$(“手风琴”)。手风琴({
高度样式:“内容”,
可折叠的:是的,
活动:parseInt(当前索引),
激活:功能(事件、用户界面){
var newIndex=$(this.children(“h3”).index(ui.newHeader);
$(“#”)val(新索引);
}
});