Geeks With Blogs

News

2004-2009
Celebrate Computer Science Education
Locations of visitors to this page
Brian Scarbeau Insights from a seasoned Computer Science Trainer

If your following along with the lessons that my students are working on then I'll report that the majority of students are working with Lesson 5 Interactive Ban Bio page.

In this lesson, students learned how to create a drop down list and checkbox web controls. For these non programming students, they found that the use of the if statement was very easy to follow with this code:

if dropdownlist1.selectedindex=0 then
  panel1.visible=true
  panel2.visible=false
  panel3.visible=false
  textbox1.visible=true
  textbox2.visible=false
  textbox3.visible=false
end if

if dropdownlist1.selectedindex=1 then
  panel1.visible=false
  panel2.visible=true
  panel3.visible=false
  textbox1.visible=false
  textbox2.visible=true
  textbox3.visible=false
end if

if dropdownlist1.selectedindex=2 then
  panel1.visible=false
  panel2.visible=false
  panel3.visible=true
  textbox1.visible=false
  textbox2.visible=false
  textbox3.visible=true
end if

One important aspect of this application is the use of the Autopostback property being set to true. Students need to know that this isn't magic that they are doing and that it's important to make sure the postback to the page is going to be the same by setting this property to true.

The student task for this lesson is as follows:

Purpose
Demonstrate the ability to use ASP controls and event code.

Instructions
You are creating a page to show a quote and the favorite song of Maktub fans. The data will be coded into the page. It does not change

This assignment for those that understand the if statement and many do at this point is to use the checkbox control and add this code to it:

Sub RadioButtonList1_SelectedIndexChanged(sender As Object, e As EventArgs)
If RadioButtonList1.selectedindex = 0 Then
Label1.Text = "Hello World"
Label2.Text = "Pizza"
End If
If RadioButtonList1.selectedindex = 1 Then
Label1.Text = "Hello Kitty"
Label2.Text = "Mr. S"
End If
If RadioButtonList1.selectedindex = 2 Then
Label1.Text = "Hello Birdie"
Label2.Text = "LHP"
End If
If RadioButtonList1.selectedindex = 3 Then
Label1.Text = "Hello Muffin Man"
Label2.Text = "Microsoft vs Macromedia"
End If
End Sub

Some students can do this task on their own and some need some hand holding to get them started but once they do the first selection their ok with the rest of the code.

Tomorrow is a test on the first three chapters.

Posted on Monday, October 31, 2005 8:01 AM Teaching with ASP.NET | Back to top

Copyright © Brian Scarbeau | Powered by: GeeksWithBlogs.net