asp+| Page | Convert original 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 the 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
in order to achieve the same effect in asp+, we used a function. In the script block, located under the Page_Load event, we created 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 (+) & ">special!! </a> "
Else
checkspecial = "--"
End If
End Function
then only need to call the function from 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 a parent object that involves the data of our asp+ Reapter control. Pass the value of the column in the parent object (that is, the asp+ Repeater control) to the function by calling Container.DataItem ("Special") and Container.DataItem ("session_id")