Author: Rain Morning

Source: Internet
Author: User
Tags chr
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 (a) & _
"Classdetail.aspx?" Sessionid= "& _
Intnumber & Chr (+) & "> 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.