多视图具有基于母版页按钮单击动态添加的视图

时间:2019-01-08 18:46:27

标签: dynamic view master-pages multiview

我正尝试根据以下问题将视图添加到多视图中:

Multiview has Views added programmatically disappear when trying to change view

但是我想基于从母版页中单击按钮加载的会话添加视图。但是,由于需要根据给定的链接将视图添加到page_init中,并且在 page init / control init 之后触发了母版页按钮的点击,根据先前设置的会话值加载数据。请提供一种实现此目标的方法

<dx:ASPxRoundPanel Width="100%"  ShowHeader="False" ID="ASPxRoundPanel1" runat="server">
    <PanelCollection>
        <dx:PanelContent ID="PanelContent2" runat="server">
        <asp:Label  ID="lblnorecords" CssClass="Utilization" runat="server"></asp:Label>
         <asp:MultiView OnInit="view_Init" ID="MultiView1" runat="server">
               <%-- <asp:View ID="View1" runat="server">
                 </asp:View>--%>
            </asp:MultiView>
             <br />
            <dx:ASPxPager ID="ASPxPager1" runat="server"  ItemsPerPage="1" OnPageIndexChanged="ASPxPager1_PageIndexChanged" 
                style="float: left; clear: both; margin-top: 16px">
                <LastPageButton Visible="True" />
                <FirstPageButton Visible="True" />
                <Summary Position="Inside" Text="Page {0} of {1} " />
            </dx:ASPxPager>
        </dx:PanelContent>
    </PanelCollection>
</dx:ASPxRoundPanel


protected void view_Init(object sender, EventArgs e)
    {
        RenderProductGridviews();
        if (MultiView1.Views.Count > 0)
            MultiView1.ActiveViewIndex = MultiView1.ActiveViewIndex < 0 ? 0 : ASPxPager1.PageIndex;
    }

protected void RenderProductGridviews()
{
 try
{
param=session["searchparam"];
DataSet ds=obj.call(param.lo,param.pgm,param.tp);//called before assigning session
}
catch(Exception ex)
{

}

0 个答案:

没有答案