Skip to main content

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

How to use MultiView and View Control in ASP.NET

The MultiView Control
The MultiView control is a container for a group of view controls . It allows you to define a group of View controls , where each View control contains child controls . Your application can then render a specific View control based on specific criteria , such as user identity, user preferences, and information passed in a querystring parameter. The MultiView control is also used to create wizard . To allow user to navigate between View controls within a MultiView control, you can add a LinkButton or Button control to each View control.

Public properties of the MultiView Class
ActiveViewIndex : Obtains or set the index value of the active View control within a MultiView control.
EnableTheming : Obtains or sets a value showing whether themes apply to the MultiView control.
Views : Obtains the collections of view controls in the MultiView control.

Public Methods of the MultiView Class
GetActiveView : Obtains the current active View control within a MultiView control.
setActiveView : Sets the specified View control to the active view within a MultiView control.

Public Event of the MultiView Class
ActiveViewChnaged : Raised when the active View control of a multiView control changes between posts to the server.

The View Control 
The view control is a container for a group of controls . A View control must always be stored within a MultiView control. Only one View control can be defined as the active view within a MultiView control at a time. A view control can contain any type of controls, including other MultiView controls. A View control does not support any style properties . To apply styles to a View Control , You have to add one or more panel controls to the View controls. To allow users to navigate between multiple View controls within a MultiView control , you can add a LinkButton or Button control to each View Control.

Public Properties of the View Class
EnableTheming : Obtains or sets a value showing if themes apply to this controls or not.
Visible : Obtains or sets a value which indicates whether the  View control is visible.




<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
        MultiView1.Visible = true;
        MultiView1.SetActiveView(View1);
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        MultiView1.Visible = true;
        MultiView1.SetActiveView(View2);
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .auto-style1 {
            font-size: larger;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <strong><span class="auto-style1">Select Buttons for birthday gift </span></strong>

    <div>
 
        <asp:Button ID="Button1" runat="server" Text="Gift 1" OnClick="Button1_Click" />&nbsp;
        <asp:Button ID="Button2" runat="server" Text="Gift 2" OnClick="Button2_Click" />
 
        <br />
        <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex ="0" Visible ="false">
            <asp:View ID="View1" runat ="server">
                <asp:Image ID="Image1" runat="server" Height="165px" ImageUrl="~/picture/images.jpg" Width="194px" />

            </asp:View>
            <asp:View ID="View2" runat ="server" >
                <asp:Image ID="Image2" runat="server" Height="165px" ImageUrl="~/picture/motorola droid.jpg" Width="191px" />

            </asp:View>
        </asp:MultiView>
 
    </div>
    </form>
</body>
</html>


Output
How to use MultiView and View Control in ASP.NET

How to use MultiView and View Control in ASP.NET

Comments

Popular Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Polynomial representation using Linked List for Data Structure in 'C'

Polynomial representation using Linked List The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows: Polynomial:      3x 3 -4x 2 +2x-9 Linked List: In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable. Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also

Print the asp.net webpage using button

Introduction Today i am talking about printing, and how to print the content or you can say selected content in asp.net. If you have a webpage and you want to print this then you have to choose command key (ctrl+p) for that. Also you want to print the selected part then you have to select the text first then you have to use command key. But sometimes your selected page could not printed. So many websites provide the printing facilities on the webpage. Today i am talking about the same topics here. Lets take a simple example to demonstrate the topic. Source code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="printpage.aspx.cs" Inherits="printpage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title></title> <script> function printpage() { var getpanel = document.getElementById("<%= Panel1.ClientID%>"); var MainWin