Asp.net Multi View control

Multiview are an easy way to declare many opportunities and show only one at a time.

Multiviz is an easy way to declare more than one view (<asp: View> is a separate control that is used as the control of multi control control) and shows only one at a time. There is no default interface like this calendar, whichever you add to your different views, you will get it when it is made available on the page, it is applied through the HTML tags you see is.



You can navigate through ideas by setting up your ActiveViewIndex property or by putting a button with pre-defined command names. To navigate through different ideas, you have to add a button / link button / image button as a navigation with the next view (to navigate to the next scene) and the preview (to navigate to the previous scene) Navigation .
Example -  

// MultiView /////////////////////////////// 

<asp:MultiView ID="MutliView1" runat="Server" ActiveViewIndex="0" OnActiveViewChanged="AutoSelectDropDown">

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

        <table style="border:1px solid #c0c0c0;">

            <tr style="background-color:#c0c0c0;">

                <th>

                    Header of View 1

                </th>

            </tr>

            <tr>

                <td>

                    <asp:TextBox ID="textBox1" runat="Server"></asp:TextBox>

                    <asp:Button ID="btnSubmit" runat="Server" Text="Submit" OnClick="SubmitFrom1stView" />

                </td>

            </tr>

            <tr>

                <td>

                    <hr />

                    Navigate Views:<br />

                    <asp:Button ID="cmdNext1" runat="server" Text="Next View >" CommandName="NextView" Font-Size="8pt" />

                </td>

            </tr>

        </table>

    </asp:View>

    <asp:View ID="View2" runat="Server">

        <table style="border: 1px solid #c0c0c0;">

            <tr style="background-color: #c0c0c0;">

                <th>

                    Header of View 2

                </th>

            </tr>

            <tr>

                <td>

                    <asp:Image ID="img1" runat="Server" ImageUrl="~/images/samples/NewAdvance.gif" AlternateText="DotNetFunda.com" />

                </td>

            </tr>

            <tr>

                <td><hr />

                    Navigate Views:<br />

                    <asp:Button ID="Button4" runat="server" Text="< Prev View" CommandName="PrevView" Font-Size="8pt" /> |

                    <asp:Button ID="Button1" runat="server" Text="Next View >" CommandName="NextView" Font-Size="8pt"  />

                </td>

            </tr>

        </table>

    </asp:View>

     <asp:View ID="View3" runat="Server">

        <table style="border: 1px solid #c0c0c0;">

            <tr style="background-color: #c0c0c0;">

                <th>

                    Header of View 3

                </th>

            </tr>

            <tr>

                <td>

                    <asp:Image ID="Image1" runat="Server" ImageUrl="~/images/samples/DotNetFunda3.gif" AlternateText="DotNetFunda.com" />

                </td>

            </tr>

            <tr>

                <td>

                    <hr />

                    Navigate Views:<br />

                    <asp:LinkButton ID="Button2" runat="server" Text="< Previous" CommandName="PrevView" /> | 

                    <asp:LinkButton ID="Button3" runat="server" Text="Next >" CommandName="NextView" />

                </td>

            </tr>

        </table>

    </asp:View>

     <asp:View ID="View4" runat="Server">

        <table style="border: 1px solid #c0c0c0;">

            <tr style="background-color: #c0c0c0;">

                <th>

                    Header of View 4

                </th>

            </tr>

            <tr>

                <td>

                    <asp:Image ID="Image2" runat="Server" ImageUrl="~/images/samples/DotNetFunda2.gif" AlternateText="DotNetFunda.com" />

                </td>

            </tr>

            <tr>

                <td>

                    <hr />

                    Navigate Views:<br />

                    <asp:Button ID="Button5" runat="server" Text="< Prev View" CommandName="PrevView" Font-Size="8pt" />

                </td>

            </tr>

        </table>

    </asp:View>


</asp:MultiView>



// Server Side Event ///////////////////////////

protected void Page_Load(object sender, EventArgs e)
    {
        // fires only when Form is posted back
        if (!IsPostBack)
        {
            dropViews.DataSource = MutliView1.Views;
            dropViews.DataTextField = "ID";
            dropViews.DataBind();
        }
    }


    // Fires when 1st view button is clicked
    protected void SubmitFrom1stView(object sender, EventArgs e)
    {
        lblMessage.Text = "<hr />TextBox Value is: <b>" + textBox1.Text + "</b>";
    }


    // Fires when DropDown selected index changes
    protected void ChangeTheViews(object sender, EventArgs e)
    {
        MutliView1.ActiveViewIndex = dropViews.SelectedIndex;
    }


    // Fires when Active Window changes. 
    // When Next or Previous button is clicked.
    protected void AutoSelectDropDown(object sender, EventArgs e)
    {
        dropViews.SelectedIndex = MutliView1.ActiveViewIndex;
    }


Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment