Master Page using Ajax in VB.NET

Master Page allow we to create a Layout for the page in our application.
  • 2840

Introduction : Master page allow we to create a Layout for the Page in our application. The single Master Page define a look and feel and standards behavior for particular page.

  • The Master Page extension is .master.
  • The Master Page is identified by a @master directive.

Step : 1 Open Visual Studio and go to File menu option.

  • Select Web Site option.
  • Select ASP.NET Web Site.
ASP-page1.gif

Step : 2 Go to Solution Explorer and right click.

  • Select Master Page option.
  • Go to Toolbox and drag and drop control.
  • Write a code.
master-page.gif

Code :

<head>
<title>my master page</title>
</head>
<
body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:Calendar ID = "Calendar1" runat = "server"></asp:Calendar>
 <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">       
</asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</
html>

Step : 3 Go to Solution Explorer and right click.

  • Select Add New Items.
  • Select Web Form.
  • Drag and drop control in Toolbox.
  • Write a code.
webformwith-master-page.gif

Code :

<
script runat="server">
Protected Sub Button1_Click(sender As Object, e As System.EventArgs)
TextBox1.Text = DateAndTime.Now.Date.ToString()
</script>
<
asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" Text="Button"
                onclick="Button1_Click1" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

Step : 4 Now press F5 and run.

  out-put.gif

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.