Welcome Guest Search | Active Topics | Sign In | Register

Dynamically load Grid in MultiPage Options
mathewvermeer
Posted: Saturday, December 28, 2013 3:42:12 PM
Rank: Newbie
Groups: Member

Joined: 12/28/2013
Posts: 0
Hey,

So I have a few pages that look a bit like this:

Code: HTML/ASPX
<eo:TabStrip runat="server" ID="TabStrip1" ControlSkinID="None" Width="400px" MultiPageID="MultiPage1" ClientSideOnItemClick="OnTabStripClick">
    [...]
</eo:TabStrip>
<eo:MultiPage runat="server" ID="MultiPage1">
    <eo:PageView ID="PageView1" runat="server">
        <eo:Grid ID="GridFirstTab" runat="server" [...]>
            [...]
        </eo:Grid>
        <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click" />
    </eo:PageView>
    <eo:PageView ID="Pageview2" runat="server">
        <eo:Grid ID="GridSecondTab" runat="server" [...]>
            [...]
        </eo:Grid>
        <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click" />
    </eo:PageView>  
</eo:MultiPage>


At the moment, the TabStrip triggers a postback, which causes the Grid in selected tab to be loaded. What I want, however, is to load the next tab and the contained Grid dynamically, instead of having to reload the entire page due to the postback. Is there a way to do this?

I've tried using a CallbackPanel and custom WebuserControls (very similar to the TabStrip and Multipage > Load On Demand demo), but this didn't work out, because I couldn't get the button's OnClick method to work.
eo_support
Posted: Saturday, December 28, 2013 6:38:42 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

This is very much a generic ASP.NET programming topic and if you search online you might be able to find more information about it. The basic rule for any dynamically created control is, you must recreate the control exactly the same way when the page posts back. This is a must for server event to work. You won't run into this issue when the control is statically declared in your page because ASP.NET would recreate them every time exactly the same way for you based on your .aspx. However when you are dynamically creating controls, you are on your own because ASP.NET won't recreate them for you.

There are various ways to recreate your control. For example, you can override the page's SaveViewState to save additional information about your new tab (such as number of new tabs, index, etc). Then you can override LoadViewState to read those information and recreate your controls. Once the controls are correctly recreated, everything else will fall into order.

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.