2006-08-16

A MulitView with dynamic Views inside an UpdatePanel Exception

After having a hard day coding just before i hit the sack i got this exception that i couldn't find any google results on:

ActiveViewIndex is being set to '0'. It must be smaller than the current number of View controls '0'. For dynamically added views, make sure they are added before or in Page_PreInit event.
Parameter name: value

I have an multiview in an updatepanel which has the individual view dynamically generated in OnLoad. So how was i supposed to register them in PreInit if the multiview hadn't even be initialised. Then i stumbled on a solution.

I added some empty dummy views in the ascx file. Then i just cleared them before loading my own dynamic ones. I only added about 10 as i dont think ill ever need more than that, but if i do ill just add some more.

<atlas:UpdatePanel ID="MultiView1UpdatePanel" Mode="Conditional" runat="server">
    <ContentTemplate>
        <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
            <asp:View ID="View0" runat="server">
                Empty
            </asp:View>
            <asp:View ID="View1" runat="server">
                Empty
            </asp:View>
            <asp:View ID="View2" runat="server">
                Empty
            </asp:View>
            <asp:View ID="View3" runat="server">
                Empty
            </asp:View>
            <asp:View ID="View4" runat="server">
                Empty
            </asp:View>
            <asp:View ID="View5" runat="server">
                Empty
            </asp:View>
            <asp:View ID="View6" runat="server">
                Empty
            </asp:View>
            <%-- add more if needed --%>
        </asp:MultiView>
    </ContentTemplate>
    <Triggers>
        <atlas:ControlEventTrigger ControlID="Menu1" EventName="MenuItemClick" />
    </Triggers>
</atlas:UpdatePanel>
 
I tried adding this in code in both PreInit and Init before and after the call to base.x() but that didn't work. Ill see later if i can cleanup this solution any better

9 comments:

Anonymous said...

order viagra online how does viagra work viagra online cheap 18 takes viagra viagra herb alternative generic brands of viagra online can women take viagra viagra overnight viagra mexico viagra rx viagra alternatives buy viagra soft online viagra and alcohol too much viagra

Anonymous said...

Nice fill someone in on and this mail helped me alot in my college assignement. Say thank you you seeking your information.

Anonymous said...

Opulently I to but I dream the collection should acquire more info then it has.

Anonymous said...

Genial dispatch and this enter helped me alot in my college assignement. Thanks you seeking your information.

Anonymous said...

Jenna Lyons at her bust, creating a Market place for Sovereign fashion design. You can use from the top trends were revolutionary in his style casual? I was just now 16 inches wide and heels would Feature been integrated through and through the wardrobe for these other nine-spot male person fashion design disasters. http://kasper-suits.net/ [url=http://kasper-suits.net]kasper womens suits[/url] [url=www.kasper-suits.net]kasper pant suits[/url] During Fashion Design week at Sir Stage37 on February 6, 2013 in New York and Sevener in London, March 2ndPhoto acknowledgment: Motion-picture show magic trick Tilda Swinton The Pallid Actress fades into this tweed enclothe. kasper dresses kasper suits kasper suits petite Catholic Charities of central Nonpareil Martins, the Illustrious fashion brands it is lovely to Attend full or first-class condition.

oakleyses said...

ray ban sunglasses, tory burch outlet, nike roshe, oakley sunglasses, ray ban sunglasses, christian louboutin, ray ban sunglasses, louis vuitton outlet, christian louboutin uk, christian louboutin outlet, louis vuitton, nike outlet, cheap oakley sunglasses, oakley sunglasses, longchamp outlet, polo ralph lauren, longchamp outlet, jordan pas cher, polo ralph lauren outlet online, burberry pas cher, longchamp pas cher, nike free, prada outlet, nike free run, ugg boots, tiffany jewelry, ugg boots, air max, polo outlet, oakley sunglasses, christian louboutin shoes, longchamp outlet, uggs on sale, louis vuitton outlet, tiffany and co, louis vuitton outlet, kate spade outlet, michael kors pas cher, replica watches, louboutin pas cher, sac longchamp pas cher, gucci handbags, louis vuitton, oakley sunglasses wholesale, chanel handbags, nike air max, replica watches, prada handbags

oakleyses said...

michael kors outlet online, nike blazer pas cher, timberland pas cher, replica handbags, michael kors, sac hermes, coach outlet, ralph lauren uk, vans pas cher, burberry outlet, ray ban pas cher, michael kors outlet, burberry handbags, uggs outlet, mulberry uk, michael kors outlet, michael kors, converse pas cher, north face uk, polo lacoste, nike air max uk, michael kors outlet, abercrombie and fitch uk, nike air force, kate spade, oakley pas cher, nike air max uk, michael kors outlet online, true religion outlet, uggs outlet, north face, ray ban uk, michael kors outlet online, hollister pas cher, nike air max, nike tn, guess pas cher, nike roshe run uk, true religion jeans, true religion outlet, coach purses, sac vanessa bruno, michael kors outlet online, new balance, lululemon canada, nike free uk, hogan outlet, true religion outlet

oakleyses said...

instyler, hollister, oakley, nfl jerseys, jimmy choo outlet, nike air max, north face outlet, soccer jerseys, louboutin, hollister, celine handbags, ghd hair, baseball bats, soccer shoes, gucci, ray ban, beats by dre, longchamp uk, lululemon, nike air max, ralph lauren, ferragamo shoes, bottega veneta, converse outlet, p90x workout, mcm handbags, nike trainers uk, converse, vans outlet, north face outlet, giuseppe zanotti outlet, hermes belt, reebok outlet, mont blanc pens, hollister clothing, chi flat iron, babyliss, herve leger, mac cosmetics, nike roshe run, valentino shoes, insanity workout, vans, nike huaraches, wedding dresses, iphone cases, timberland boots, new balance shoes, abercrombie and fitch, asics running shoes

oakleyses said...

canada goose, louis vuitton, replica watches, juicy couture outlet, pandora jewelry, canada goose, ugg,uggs,uggs canada, doudoune moncler, canada goose outlet, canada goose uk, canada goose jackets, louis vuitton, moncler outlet, barbour, pandora charms, ugg, moncler, louis vuitton, ugg uk, lancel, barbour uk, marc jacobs, moncler, links of london, karen millen uk, toms shoes, swarovski, wedding dresses, canada goose, louis vuitton, ugg,ugg australia,ugg italia, pandora jewelry, moncler, moncler outlet, supra shoes, hollister, swarovski crystal, thomas sabo, juicy couture outlet, canada goose outlet, moncler uk, pandora uk, coach outlet, ugg pas cher, louis vuitton, montre pas cher, canada goose outlet, moncler