Migrate from ASP to asp+--convert other pages

Source: Internet
Author: User
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")











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.