Author: Rain Morning As for the remaining pages, we dots, using asp+ DataList or Repeater controls. This is necessary because the design requires custom data layouts, rather than a standard table display. One of the pages, classcatalog.aspx, has a requirement to check the value, and then run one of the two possible outputs based on the selected value. The page took advantage of the repeater control, so we created the rows and columns of the table without letting the control do all of this. It was done inside the templates. In an ASP, it looks like this:
' Check for Offers If rssessions ("Special") = True Then ' If this course offers a discount, the output ' Special offer! ' Response.Write "< TD Valign=top Align=center>" & vbCrLf Response.Write "< a href=" "Classdetail.asp? Sessionid= " Response.Write rssessions ("SessionID") Response.Write "" "Name=" "Click for more Detail" ">" Response.Write "Special offer!" Response.Write "</td>" Else ' If this course does not offer a discount, the output in the column '--' Response.Write "< TD Valign=top align=center>--</TD>" End If To achieve the same effect in asp+, we used a function. In the script block, located under the Page_Load event, we create the following code: Function checkspecial (ByRef blnspecial as Boolean, _ ByRef intnumber as Integer) as String If blnspecial = True Then Checkspecial = "< a href=" & Chr (+) & _ "Classdetail.aspx?" Sessionid= "& _ Intnumber & Chr (a) & ">special!! </a> " Else Checkspecial = "--" End If End Function Then you only need to call the function from the asp+ repeater: < template name = "ItemTemplate" > < tr> [Other data being displayed] < TD Valign=top Align=center> <%=checkspecial (Container.DataItem ("Special"), Container.DataItem ("session_id"))%> </td> </tr> </template> Container refers to the parent object that involves the data of our asp+ Reapter control. by calling Container.DataItem ("Special") and Container.DataItem ("session_id"), the values of the columns in the parent object (that is, the asp+ Repeater control) are passed to the function.
|