1 / 5

MIS 3200

MIS 3200. Page Counter Session Variables Else If. Time to try it out- L1. The purpose of this L1 will be to create a page counter for your portfolio homepage Place a label on your page and name it “ lblCounter ” Before the label type “Page Counter: “

cormac
Télécharger la présentation

MIS 3200

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MIS 3200 Page Counter Session Variables Else If

  2. Time to try it out- L1 The purpose of this L1 will be to create a page counter for your portfolio homepage • Place a label on your page and name it “lblCounter” • Before the label type “Page Counter: “ Now, switch to your code behind by right-clicking in an empty space on your page and selecting “view code.”

  3. L1 #2 • Below the line: • declare an int variable to hold the page count and set its initial value to 0. • Now we will begin working with a session variable we will call Session[“CountCounter”] • In the Page_Load method, create an if statement to see if Session[“CountCounter”] is null. • If null, set your int variable to 0 • If not, convert your session to an int and place the value in your int variable

  4. L1 #3 • After the if statement: • increase your variable by one • set • Now, using a series of else if statements, place your count in the label • If the count is under ten, include 000 in front of your count • If the count is under 100, include 00 in front of your count • If the count is under 1000, include 0 in front of your count • Add page level comments, create a link to this page from your MIS3200 page and copy everything to ASPNET and submit your MIS Portfolio URL to the drop box.

  5. For Dr. Matta: My Final Code

More Related