ARTICLE

Working with Master Page using Ajax

Posted by Davin Martyn Articles | ASP.NET AJAX in VB.NET September 26, 2011
Master Page allow we to create a Layout for the page in our application.
 
Reader Level:

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

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor