Ask DOT NET Expert

This exercise, you add a TextBox, a Label, and a Button control to a page. When you request the page in the browser, these server controls are transformed into HTML, which is then sent to the client. looking at the final HTML for the page in the browser, you'll see how the HTML is completely different from the initial ASP.NET markup.

1. Open the Planet Wrox project in Visual Web Developer.

2. In the Demos folder in the Solution Explorer, create a new Web Form called ControlsDeno. aspx. Choose your programming language and make sure the Web Form uses Code Behind.

3. Switch to Design View. From the Toolbox, drag a TextBox, a Button, and a Label control onto the design surface within the dashed lines of the tag that was added for you when you created the page.

4. Right-click the Button and choose Properties to open up the Properties Grid for the control. Pressing F4 after selecting the Button does the same thing. The window that appears, shown in Figure 4-2, enables you to change the properties for the control, which in turn influence the way the control behaves at runtime.

5. Set the control's Text property to submit xnformatson and set its In (which you'll find all the way down at the bottom of the list wrapped in parentheses) to surraitBut ton.

6. Change the ID of the textftox to YourName using the Properties Grid.

7. Clear the Text property of the Label using the Properties Grid. You can right-click the property' label in the grid and choose Reset, or you can manually remove the text. You can leave its ID set to Labell.

8. Still in Design View, double-click the button to have VWD add some code to the Code Behind of the page that will be fired when the button is clicked in the browser. Add the bolded line of code the code block that VWD Inserted for you:
VB.NET

Protected Sub SUbmitButton_Click(ByVal sender As Object,
ByVal a As System.EventArgs) Handles SubmitButton.Click

Labell.Text ="your name is + & YourName.Text;
End Sub
CO
protected void SubmitButton_Click(object sender. EventArgs e)

{

labell.Text =" your name is " = YourName.Text;

}

Note that the VB.NET example doesn't need an underscore here to split the code over two lines. In previous versions of VB.NET the underscore was required to split this code over two lines.

9. Save the changes to the page and then open it in the browser by pressing Ctrl+F5. When it appears in the browser, don't click the button yet, but open up the source of the page by right-clicking the

page in the browser and choosing View Source or View Page Source. You should see the following HTML code Cl changed the formatting slightly so the HTML fits on the page):

Your name



10. Switch back to your browser, fill in your name in the text box, and click the button. When the page is done reloading, open up the source for the page in the browser again using the browser's right-click menu. The code should now look like this:
Your nano

Your name type=text= value="imar" id=Yourname />




Your sans is Imar
< div>

DOT NET, Programming

  • Category:- DOT NET
  • Reference No.:- M91336219
  • Price:- $40

Guranteed 36 Hours Delivery, In Price:- $40

Have any Question?


Related Questions in DOT NET

Assignment specificationthis assignment is split into two

ASSIGNMENT SPECIFICATION This assignment is split into two documents. 1. Assignment Specification. This document contains the specification for what you will be required to do. 2. Assignment Addendum. This document conta ...

Scenariouser modelling inc would like to organize a series

Scenario User Modelling Inc. would like to organize a series of conferences focusing on research topics in the area of user adaptive systems and personalization. They need to organize annual conferences for researchers a ...

Casewe sell pdfs from our site and pdfs can be ordered from

Case We sell pdf''s from our site and pdfs can be ordered from the site by selecting a book, putting it in a shopping cart, then signing in with a password or as a guest, and then checking out. For some reason, when a pu ...

Summarythis assessment requires you to develop a simple

Summary This assessment requires you to develop a simple text editor with a basic offline user login. It is a windows application that will allow new uses to be added, existing users to login, and to create/save/edit tex ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As