Monday 8 January 2018

Learn ASP.NET web from in urdu/hindi (Part-17){Multi view Control in asp...







<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication10.WebForm1" %>



<!DOCTYPE html>



<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>



    <style>



       table

        {

           border:3px solid red;

        }



    </style>

</head>

<body>

    <form id="form1" runat="server">

    <div>



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



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

                <table>



                    <tr>

                         <td> <asp:Label ID="Label1" runat="server" Text="Email"></asp:Label></td>

                       

                         <td>

                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </td>



                    </tr>

                   

                    <tr>

                         <td> <asp:Label ID="Label2" runat="server" Text="Password"></asp:Label></td>

                       

                         <td>

                        <asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox> </td>



                    </tr>



                    <tr>

                        <td> </td>

                        <td> <asp:Button ID="Button1" runat="server" Text="NEXT->" OnClick="Button1_Click" /></td>

                       



                    </tr>

                </table>

            </asp:View>



            <%--1st view end.....-------------------------------------------------------------.--%>

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





                      <table>



                    <tr>

                         <td> <asp:Label ID="Label3" runat="server" Text="Name"></asp:Label></td>

                       

                         <td>

                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> </td>



                    </tr>

                   

                    <tr>

                         <td> <asp:Label ID="Label4" runat="server" Text="Gender"></asp:Label></td>

                       

                         <td>

                             <asp:DropDownList ID="DropDownList1" runat="server">

                                 <asp:ListItem>Male</asp:ListItem>

                                 <asp:ListItem>Female</asp:ListItem>

                             </asp:DropDownList>

                        </td>



                    </tr>



                    <tr>

                        <td> <asp:Button ID="Button3" runat="server" Text="Back<-" OnClick="Button3_Click" /></td>

                        <td> <asp:Button ID="Button2" runat="server" Text="NEXT->" OnClick="Button2_Click" /></td>

                       



                    </tr>

                </table>









            </asp:View>





              <%--2nd view end.....-------------------------------------------------------------.--%>

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



                 <table>



                    <tr>

                         <td> <asp:Label ID="Label5" runat="server" Text="Email"></asp:Label></td>

                       

                         <td>

                          <asp:Label ID="lblemail" runat="server" Text=""></asp:Label>

                         </td>



                    </tr>

                   

                    <tr>

                         <td> <asp:Label ID="Label6" runat="server" Text="Name"></asp:Label></td>

                       

                         <td>

                            <asp:Label ID="lblname" runat="server" Text=""></asp:Label>

                        </td>



                    </tr>



                          <tr>

                         <td> <asp:Label ID="Label7" runat="server" Text="Gender"></asp:Label></td>

                       

                         <td>

                            <asp:Label ID="lblgender" runat="server" Text=""></asp:Label>

                        </td>



                    </tr>







                    <tr>

                        <td> <asp:Button ID="Button4" runat="server" Text="Back<-" OnClick="Button4_Click" /></td>

                        <td> <asp:Button ID="Button5" runat="server" Text="NEXT->" OnClick="Button5_Click" /></td>

                       



                    </tr>

                </table>











            </asp:View>















        </asp:MultiView>

   

    </div>

    </form>

</body>

</html>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication10
{
    public partial class WebForm1 : System.Web.UI.Page
    {
     
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MultiView1.ActiveViewIndex = 0;
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //next -1
            
            MultiView1.ActiveViewIndex = 1;

            

        }

        protected void Button2_Click(object sender, EventArgs e)
        {
           
            MultiView1.ActiveViewIndex = 2;

            lblemail.Text = TextBox1.Text;
            lblgender.Text =DropDownList1.SelectedItem.ToString() ;
            lblname.Text = TextBox3.Text;

            //next -2
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            //back-1
            MultiView1.ActiveViewIndex = 0;
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            //submit
        }

        protected void Button4_Click(object sender, EventArgs e)
        {
            //back-2
            MultiView1.ActiveViewIndex = 1;
        }
    }
}

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...