小编Mat*_*rri的帖子

ascx中的Updatepanel刷新整个控件

我有一个sitecore proejct,我已经以ascx用户控件的形式准备了一个子布局.我需要在这个用户控件中设置级联下拉菜单,并根据我发现的UpdatePanel是要走的路.问题是UpdatePanel似乎刷新了整个控件,我不认为这是正确的行为.

我知道SO上有一些类似的问题,但没有一个解决方案适合我.我也开始怀疑这可能是Sitecore的具体问题.

以下是用户控件的代码示例:

    <p><%= MyItem.Text %>" /></p>

    <asp:UpdatePanel ID="LocationFilterUpdatePanel" runat="server">
    <ContentTemplate>

        <asp:DropDownList ID="DDL1" OnSelectedIndexChanged="DDL1_SelectedIndexChanged" runat="server" AutoPostBack="true">

        </asp:DropDownList>


        <asp:DropDownList ID="DDL2"  OnSelectedIndexChanged="DDL2_SelectedIndexChanged" runat="server" AutoPostBack="true">

        </asp:DropDownList>

    </ContentTemplate>
    </asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)

而守则背后:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!System.Web.UI.ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
        {
            var context = new SitecoreContext();
            //Get Model from Sitecore

            DDL1.DataSource = Model.Data;
            DDL1.DataValueField = "Id";
            DDL1.DataTextField = "Name";
            DDL1.DataBind();
        }

    }

    protected void DDL1_SelectedIndexChanged(object sender, EventArgs e)
    {
        var context = new SitecoreContext();
        //Get Model from Sitecore

        DDL2.DataSource = Model.Data;
        DDL2.DataValueField = "Id"; …
Run Code Online (Sandbox Code Playgroud)

asp.net updatepanel sitecore sitecore7

4
推荐指数
1
解决办法
1238
查看次数

调用changepage后未触发pagebeforeshow事件

我刚刚开始进行jQM开发并且遇到了一些障碍.

简而言之,我有一个javascript文件和两个页面.在主页面(index.html)中,我动态填充列表视图,并为此列表视图的每个项目注册tap事件.作为回报,on tap事件将changepage方法调用到外部页面(details.html).这在100%的时间内都能正常工作.

在javascript文件中,我正在pagebeforeshow上注册details.html页面上的事件.这可以在第一次运行时正常工作,但任何后续调用都不会触发pagebeforeshow事件.仔细看后我可以看到正在调用pagechange,pagebeforechange事件正在被解雇,但是pagebeforeshow仅针对该特定项目被触发(直到完全刷新).

我已经为您设置了一个样本供您查看.我会非常感谢任何给出的反馈.据我所知 - 我可能正在使用错误的事件!?

我在SO上找到的最接近的帖子是Pagebeforeshow没有在第二次更改页面事件时触发,但它并没有特别处理列表视图,所以我不确定它是否相关.

谢谢,

马特

的index.html

   <head>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
    <script src="jquery.custom.js" type="text/javascript"></script>
</head>
<body>
    <!-- All Stock Search -->
    <div id="idxPage" data-role="page" style="height:50px;" data-title="Main Menu">
        <div data-role="header" class="sixteen columns">
            <a href="index.html" data-icon="home" data-direction="reverse">Home</a>
            <h1>
                <a href="index.html" data-icon="home" data-direction="reverse"> Test </a>
            </h1>
        </div>

        <div data-role="content" style="text-align:center;">    
        <ul id="ListItems" data-role="listview" data-inset="true" data-filter="true">
        </ul>
        </div><!-- /content -->
        <footer>
            <div data-role="footer" data-id="connfooter" class="ui-footer ui-bar-a" role="contentinfo"> 
                <h4 …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-mobile

2
推荐指数
1
解决办法
5348
查看次数