Wednesday, July 30, 2008

MultiView usage

I had never used one before, but a MultiView seemed like a good fit for a “code-less” report that I was working on:

 

<asp:MultiView ID="MultiView1" runat="server">

    <asp:View ID="mvwApplications" runat="server">

        <asp:GridView ID="gvwAppDetail" runat="server" DataSourceID="odsAppDetail" AllowSorting="true" />

    </asp:View>

    <asp:View ID="mvwServers" runat="server">

        <asp:GridView ID="gvwServers" runat="server" DataSourceID="odsServerDetail" AllowSorting="true" />

    </asp:View>

    <asp:View ID="mvwDatabases" runat="server">

        <asp:GridView ID="gvwDatabases" runat="server" DataSourceID="odsDBDetail" AllowSorting="true" />

    </asp:View>

    <asp:View ID="mvwTools" runat="server">

        <asp:GridView ID="gvwTools" runat="server" DataSourceID="odsToolDetail" AllowSorting="true" />

    </asp:View>

    <asp:View ID="mvwLanguages" runat="server">

        <asp:GridView ID="gvwLanguages" runat="server" DataSourceID="odsLangDetail" AllowSorting="true" />

    </asp:View>

</asp:MultiView>

 

The MultiView is controled using LinkButtons:

 

Protected Sub tab_Command(ByVal sender As Object, ByVal e As CommandEventArgs) 

        MultiView1.ActiveViewIndex = CType(e.CommandArgument, Integer)

        CType(sender, LinkButton).CssClass = "btnwide"

    End Sub

 

 

 

No comments: