News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

Main Menu

How to create the Web project

Started by sukishan, Jul 14, 2009, 03:38 PM

Previous topic - Next topic

sukishan

To create the Web project
Click File, point to Add, and click New Web Site.

The Add New Web Site dialog appears.

In the Location, type C:\Inetpub\wwwroot\BrowserComponent.

Click OK.

The project creates a stub Web site, and since there is no web.config file, the project will not build at this point.

Right-click Default.aspx, and then click Set as Start Page.

Open Default.aspx, and replace the contents with the following code:

Copy Code
<%@ Import Namespace="BrowserComponent" %>

<html>

    <script language="VJ#" runat="server">

        public void Page_Load(Object sender, EventArgs E)
     {
            //Request the address in South Africa.
            BrowserComponent comp = new BrowserComponent();

            String[] arrAddress = comp.GetCompanyAddress(2);
            StringBuilder sbAddress = new StringBuilder();
            sbAddress.Append("XYZ Customer Branch
 ");
            for (int idx = 0; idx < arrAddress.length; idx  )
            {
                sbAddress.Append(arrAddress[idx]    "
 ");
            }
             Message.set_InnerHtml(sbAddress.ToString());
        }
    </script>
    <head><title>Locate Closest Customer Office</title></head>
    <body style="font: 10pt verdana">
        <h3>A Simple Managed Component</h3>
     
        <h5>Thank you for your inquiry. Our mailing address is:</h5>
        <table><tr><td>     
        <div id="Message" runat="server" />
        </td></tr></table>
    </body>
</html>On the Page_Load method, the BrowserComponent class has a new managed instance. The instance calls GetCompanyAddress method and requests the address for corporate office number 291. As an enhancement, your own application can prompt the user in some way and derive the office number before calling GetCompanyAddress.
A good beginning makes a good ending