Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASP Web Server Controls Please use speaker notes for additional information!

Similar presentations


Presentation on theme: "ASP Web Server Controls Please use speaker notes for additional information!"— Presentation transcript:

1 ASP Web Server Controls Please use speaker notes for additional information!

2 Label Web Server Control ASP.NET Label Web Server Control Label Web Server Control Label Web Server Control ASP.NET Label Web Server Control Simple example of a label control! My code. Output Results of viewing source.

3 Label Web Server Control Testing the Label Web Server Control Sub Page_Load lblHeader.Text="Testing the Label Web Server Control" lblDate.Text="Today is: " & now() End Sub ASP.NET

4 Testing the Label Web Server Control ASP.NET Testing the Label Web Server Control Today is: 6/24/2003 4:56:55 PM Testing the Label Web Server Control Sub Page_Load lblHeader.Text="Testing the Label Web Server Control" lblDate.Text="Today is: " & now() End Sub ASP.NET My code is shown here. The output is shown here. When you click on view source, you see the code below.

5 Testing the Label Web Server Control Sub Page_Load(sender As Object, e As EventArgs) lblHeader.Text="Testing the Label Web Server Control" lblDate.Text="Today is: " & now() End Sub ASP.NET Label Web Server Control

6 Textbox Web Server Control Sub NameSub(sender As Object, e As EventArgs) lblGreet.text = "Hi, " & txtFst.text & " " & txtLast.text End Sub ASP.NET Textbox Web Server Control First Name Last Name Button & Textbox Web Server Controls

7 Textbox Web Server Control ASP.NET Textbox Web Server Control First Name Last Name Hi, Susan Ash

8 List before I checked anything. List after I checked the three components of my sentence.

9 Here I unclicked the horse and you can see the sentence is simply jumped over the fence. Now I clicked The dog and the sentence got reformed starting with the first clicked element and moving sequentially through the last clicked item.

10 Make sentences using List Items Sub makeSentence(sender As Object, e As EventArgs) dim ct mySentence.Text=" Your sentence: " for ct =0 to phrases.Items.Count-1 if phrases.Items(ct).Selected then mySentence.Text=mySentence.Text & " " & phrases.Items(ct).Text end if next End Sub Sub clear(Source As Object, e As EventArgs) dim pt for pt = 0 to phrases.Items.Count-1 if phrases.Items(pt).Selected then phrases.Items(pt).Selected = False end if next mySentence.Text="" End Sub Each time this is executed, it checks all of the check boxes and concatenates each box that is checked to the mySentence structure. This code clears by checking to see if the item is checked and if it is setting it to false. Obviously, I did not need to do the check, I could have just set them all to false. Clears the sentence which is made up of the phrase Your sentence in a paragraph followed by the selected elements formed into the mySentence structure. The mySentence structure is a paragraph that says Your sentence: followed by the sentence I put together.

11 The dog The cat The bird The fish The horse ran flew swam jumped trotted over the fence onto the railing into the rock down the hill into the tree into the cage up the stream The event OnSelectedIndexChanged causes makeSentence to be executed. This code sets up the elements in the list. The label holds the sentence that was constructed. A clear button is set up. The on click event causes the clearButton sub to be executed.

12 Your sentence: The horse jumped over the fence The dog Make sentences using List Items

14

15 Make sentences using List Items Fare Table From Boston From NY From DC To London To San Francisco Table Web Server Control Continued on next slide...

16 To Baku To Oslo

17

18 Table Sub getFare(sender As Object, e As EventArgs) dim strFare as string dim intFromIndx as integer dim intToIndx as integer dim objRow as TableRow dim objCell as TableCell intFromIndx = fromCity.SelectedIndex intToIndx = toCity.SelectedIndex objRow = flyPrice.Rows.Item(intToIndx+1) objCell = objRow.Cells.Item(intFromIndx+1) strFare = objCell.Text yourFare.Text="Your fare is: " & strFare End Sub From Boston From NY From DC To London To San Francisco To Baku To Oslo

19 GridLines="both" HorizontalAlign="Left"> Fare Table From Boston From NY From DC To London To San Francisco To Baku To Oslo This shows the setup of the table and cells and the data contained. You can see the headers and the data. I know use label to show the id of yourFare which was generated in the OnClick execution of getFare.

20 Table From Boston From NY From DC To London To San Francisco To Baku To Oslo Fare Table From Boston From NY From DC To London To San Francisco To Baku To Oslo Your fare is: 245


Download ppt "ASP Web Server Controls Please use speaker notes for additional information!"

Similar presentations


Ads by Google