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

6 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.

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