Loading...

MultiView


MultiView ActiveViewIndex Example
This is the content for View1.
@inherits ControlComponent

<asp.MultiView @ref="this.multiView" ActiveViewIndex="0">
                                            <asp.View>
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for View1.">
                                            </asp.Label>
                                            <br />
                                            <asp.Button Text="Previous"
                                            Enabled="false"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            <asp.Button Text="Next"
                                            OnClick="this.NextButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            </asp.View>
                                            <asp.View>
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for View2.">
                                            </asp.Label>
                                            <br />
                                            <asp.Button Text="Previous"
                                            OnClick="this.BackButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            <asp.Button Text="Next"
                                            OnClick="this.NextButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            </asp.View>
                                            <asp.View>
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for View3.">
                                            </asp.Label>
                                            <br />
                                            <asp.Button Text="Previous"
                                            OnClick="this.BackButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            <asp.Button Text="Next"
                                            OnClick="this.NextButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            </asp.View>
                                            <asp.View>
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for View4.">
                                            </asp.Label>
                                            <br />
                                            <asp.Button Text="Previous"
                                            OnClick="this.BackButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            <asp.Button Text="Next"
                                            OnClick="this.NextButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            </asp.View>
                                            <asp.View>
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for View5.">
                                            </asp.Label>
                                            <br />
                                            <asp.Button Text="Previous"
                                            OnClick="this.BackButton_Command"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            <asp.Button Text="Next"
                                            Enabled="false"
                                            Height="30"
                                            Width="75">
                                            </asp.Button>
                                            </asp.View>
</asp.MultiView>

@code {
                                            private MultiView multiView;

                                            protected void NextButton_Command(object sender, EventArgs e)
    {
                                            // Determine which button was clicked
                                            // and set the ActiveViewIndex property to
                                            // the view selected by the user.
                                            if (multiView.ActiveViewIndex > -1 & multiView.ActiveViewIndex < multiView.Views.Count - 1)
        {
                                            // Increment the ActiveViewIndex property
                                            // by one to advance to the next view.
            multiView.ActiveViewIndex += 1;
        }
                                            else
        {
                                            throw new Exception("An error occurred.");
        }
    }

                                            protected void BackButton_Command(object sender, EventArgs e)
    {
                                            if (multiView.ActiveViewIndex > 0 & multiView.ActiveViewIndex < multiView.Views.Count)
        {
                                            // Decrement the ActiveViewIndex property
                                            // by one to return to the previous view.
            multiView.ActiveViewIndex -= 1;
        }
                                            else
        {
                                            throw new Exception("An error occurred.");
        }
    }
}
MultiView Class Example
This is the content for Default View.
Go to News View
Go to Shopping View
@inherits ControlComponent

<asp.MultiView @ref="this.multiView" ActiveViewIndex="0">
                                            <asp.View @ref="this.defaultView">
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for Default View.">
                                            </asp.Label>
                                            <br />
                                            <asp.LinkButton Text="Go to News View"
                                            OnCommand="this.LinkButton_Command"
                                            CommandArgument="News"
                                            CommandName="Link"
                                            Width="200px">
                                            </asp.LinkButton>
                                            <br />
                                            <asp.LinkButton Text="Go to Shopping View"
                                            OnCommand="this.LinkButton_Command"
                                            CommandArgument="Shopping"
                                            CommandName="Link"
                                            Width="200px">
                                            </asp.LinkButton>
                                            </asp.View>
                                            <asp.View @ref="this.newsView">
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for News View.">
                                            </asp.Label>
                                            <br />
                                            <asp.LinkButton Text="Go to Default View"
                                            OnCommand="this.LinkButton_Command"
                                            CommandArgument="DefaultView"
                                            CommandName="Link"
                                            Width="200px">
                                            </asp.LinkButton>
                                            <br />
                                            <asp.LinkButton Text="Go to Shopping View"
                                            OnCommand="this.LinkButton_Command"
                                            CommandArgument="Shopping"
                                            CommandName="Link"
                                            Width="200px">
                                            </asp.LinkButton>
                                            </asp.View>
                                            <asp.View @ref="this.shoppingView">
                                            <asp.Label FontBold="true"
                                            FontSize="14"
                                            Text="This is the content for Shopping View.">
                                            </asp.Label>
                                            <br />
                                            <asp.LinkButton Text="Go to Default View"
                                            OnCommand="this.LinkButton_Command"
                                            CommandArgument="DefaultView"
                                            CommandName="Link"
                                            Width="200px">
                                            </asp.LinkButton>
                                            <br />
                                            <asp.LinkButton Text="Go to News View"
                                            OnCommand="this.LinkButton_Command"
                                            CommandArgument="News"
                                            CommandName="Link"
                                            Width="200px">
                                            </asp.LinkButton>
                                            </asp.View>
</asp.MultiView>

@code {
                                            private MultiView multiView;
                                            private View defaultView;
                                            private View newsView;
                                            private View shoppingView;

                                            protected void LinkButton_Command(object sender, CommandEventArgs e)
    {
                                            // Determine which link button was clicked
                                            // and set the active view to
                                            // the view selected by the user.
                                            switch (e.CommandArgument)
        {
                                            case "DefaultView":
                multiView.SetActiveView(defaultView);
                                            break;
                                            case "News":
                multiView.SetActiveView(newsView);
                                            break;
                                            case "Shopping":
                multiView.SetActiveView(shoppingView);
                                            break;
                                            default:
                                            throw new Exception("You did not select a valid list item.");
        }
    }
}

MultiView Metadata
Name Type Kind
ActiveViewIndex Int32 Parameter
Attributes IReadOnlyDictionary Parameter
ChildLevel Int32 Parameter
ClientIDMode ClientIDMode Parameter
ID String Parameter
Visible Boolean Parameter
OnActiveViewChanged EventHandler Event
OnDataBinding EventHandler Event
OnDisposed EventHandler Event
OnInit EventHandler Event
OnLoad EventHandler Event
OnPreRender EventHandler Event
OnUnload EventHandler Event
Attributes IReadOnlyDictionary Parameter
ClientIDMode ClientIDMode Parameter
ID String Parameter
Visible Boolean Parameter
OnActivate EventHandler Event
OnDataBinding EventHandler Event
OnDeactivate EventHandler Event
OnDisposed EventHandler Event
OnInit EventHandler Event
OnLoad EventHandler Event
OnPreRender EventHandler Event
OnUnload EventHandler Event
Copyright © 2024 Jurio li All rights reserved.
An unhandled error has occurred. Reload 🗙