Presentation is loading. Please wait.

Presentation is loading. Please wait.

MIS 3200 – Unit 5.2 ListItem controls and accumulation

Similar presentations


Presentation on theme: "MIS 3200 – Unit 5.2 ListItem controls and accumulation"— Presentation transcript:

1 MIS 3200 – Unit 5.2 ListItem controls and accumulation
Converting ListItem controls Accumulation with while loops Accumulation with for loops

2 Converting ListItems Assume we have created a CheckBoxList called cblMenu which looks like this: The source view of cblMenu might look like this:

3 Converting ListItems #2
We can easily convert a CheckBoxList into a ListBox (or visa versa) by changing the description in the source, like this: Properties that are not described by the control are simply ignored (RepeatDirection is not a property of a ListBox – see the next slide) Don’t forget to change the ID to an appropriate name like, lbMenu

4 Working with ListItems #3
You will get a message that RepeatDirection is invalid, but it will not prevent the page from running and you can remove it from the statement.

5 Accumulating with While Loops

6 Accumulating with For Loops

7 Time to try it out – Unit 5 L2
Accumulation with While and For loops Copy your lastnameU5L1.aspx and paste it in the Unit 5 as lastnameU5L2.aspx Re-name the heading to UNIT 5 L2 WORKING WITH LOOPS – LISTBOX Remove the CHECKBOXLIST H3 heading Set the Visible property of both Demonstrate buttons to false

8 L2 #2 Previously, you were accumulating the values from the CheckBoxList by using several if statements to test whether or not each checkbox was selected; replace your existing if statements (those related only to accumulating fees) with a for loop which should make the code easier to read and allow for many more fees to be considered without adding any additional code (note, your control and variable names may not be the same):

9 L2 #3 Let’s allow for many more fees to be added without making the page considerably longer; to do this, change to the source view and change the word CheckBoxList to ListBox before after Best practice says to change the ID to something like lbFees

10 L2 #4 Switch back to design view and change the Rows property of the ListBox to 5 (it should now look like this) Add two more fees to the ListBox: Tow Fee (value set to 50.00) Impound Fee (value set to ) see the Unit 4.2 slides if you need help editing ListControl items

11 L2 #5 The ListBox now should have a scrollbar on the right-hand side like this Change the check all fees that apply to select all fees that apply Set the SelectionMode property of the ListBox to multiple this will allow us to select multiple items at the same time

12 L2 #6 Add appropriate comments to explain what the for loop is doing for the method Create a link to your U5L2 page from your MIS3200 page and copy everything to ASPNET and submit your MIS Portfolio URL to the drop box.

13 Think About It! While and for loops made accumulation easier, but did the listbox improve the usability of our L2?


Download ppt "MIS 3200 – Unit 5.2 ListItem controls and accumulation"

Similar presentations


Ads by Google