Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to add views to a multiview
but I want to add views based on the session updated from a button click in the master page. But since the views need to be added in a content page page_init, and the master page button click is fired after the page init/control init, the view is getting loaded with data based on the previously set session values. kindly advise a way to load the view based on the session set in the master button click event

Code

What I have tried:

<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


C#
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);//getting called before assigning session from master page in the "view" button click. so taking previously assigned session values
}
catch(Exception ex)
{

}
Posted
Comments
Sinisa Hajnal 10-Jan-19 6:12am    
Why don't you just change the app design so you don't depend on the init event? Load required data and render it at a later event.

Or...pass the search parameter as part of the url, that way you will have the info regardless of the page life cycle

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900