同一用户控件在页面中多次使用无法正常工作 [英] Same User control use for multiple times in a page is not working properly

查看:65
本文介绍了同一用户控件在页面中多次使用无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面结构就像

Page structure is like

<asp:Panel ID="pnlResultSet" runat="server">
        <asp:UpdatePanel ID="uplrepeter" runat="server" UpdateMode="Always">
            <ContentTemplate>
                <uc1:PostBackPager ID="PostBackPager2" runat="server" OnNextPageChanged="NextChanged"

                                            OnPreviousPageChanged="PreviousChanged" OnPageChanged="PageChanged" />
                <%--Some Code will be here--%>
                <%--The control "PostBackPager" is for paging for the above portion.
                Now When I click on Page 2 of the usercontrol PostBackPager1
                it changes to page 2 but PostBackPager2 remains its initial state
                and the same is happening for vice versa.--%>
                <uc1:PostBackPager ID="PostBackPager1" runat="server" OnNextPageChanged="NextChanged"

                                            OnPreviousPageChanged="PreviousChanged" OnPageChanged="PageChanged" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>



现在的问题是:

控件"PostBackPager"用于上述部分的分页.现在,当我单击用户控件PostBackPager1的页面2时,它将更改为页面2,但PostBackPager2保持其初始状态,反之亦然.

在此先感谢..



Now the problem is:

The control "PostBackPager" is for paging for the above portion. Now When I click on Page 2 of the usercontrol PostBackPager1 it changes to page 2 but PostBackPager2 remains its initial state and the same is happening for vice versa.

Thanks in advance..

推荐答案

您必须了解,尽管它们是两个相同的用户控件,但是在呈现它们时,其中所有控件的名称和ID完全不同.的.在您为第一个UC进行更改之前,不会对第二个UC进行任何更改.由于两者都在同一更新面板中,所以这不是问题. Juse同步(使用服务器端的代码)基于触发的UC同步另一个-完成后,它将回传.
You have to understand that though they are two same usercontrol but when they are rendered all the controls inside them have totally different name and ID''s. Making some change in first UC would not make any change in second UC until you write for it. Since both are in same Update Panel, this should not be an issue. Juse sync (using code on server side) the other one based on the triggered UC - once done, it will reflect back.


这篇关于同一用户控件在页面中多次使用无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆