ASP. NET foreground displays the background value

Source: Internet
Author: User
You can use multiple methods from ASP. NET Program Display information. One way is to use the <% = %> structure. Another method is to use the response. Write statement.

1. Use <% = %>
The simplest way to display information from ASP. net programs is to use the <% = %> structure. The value entered after the equal sign is written to the current page.
The 1.1 format is:
<% = Subsequent changes %>
1.2 examples:
1.2.1 subsequent generations: Public   Partial   Class Default_null: system. Web. UI. Page
{
///   <Summary>
/// Definition of changes shown on the front-end
///   </Summary>
Public   String Svalue =   "" ;
Protected   Void Page_load ( Object sender, eventargs e)
{

/*
change the renewal value
Note :@"", indicates that the content in the quote is all a string
*/
svalue = @" This is the content to be displayed on the front-end,
here we have multiple rows of audio streams " ;
}< BR >}

1.2.2 previous Source Region: < Head Runat = "Server" >
< Title > Untitled faces </ Title >
</ Head >
< Body >
< Form ID = "Form1" Runat = "Server" >
< Div >
<! -- Svalue is the variable defined by the backend. This variable value will be shown here -->
<% = Svalue %>
</ Div >
</ Form >
</ Body >
</ Html >

1.2.3 result: This is an internal content to be displayed on the front-end. Here we have multiple lines for further demonstration.

2. response. Write statement
Another way to display text is to use the response. Write statement. You can place it in the <%> block.
Format 2.1
<% Response. Write ("content to be specified") %>.
The output of the response. Write statement is merged into the processing page. In this way, write Response. Write output is allowed. Code And the code can display text.
2.2 examples:
2.2.1 inbound from source region: < Head Runat = "Server" >
< Title > Untitled faces </ Title >
</ Head >
< Body >
< Form ID = "Form1" Runat = "Server" >
< Div >
<! -- Show content here -->
<% Response. Write ( " <Br> response. Write your response " ); %>
</ Div >
</ Form >
</ Body >
</ Html >

2.2.2 result:

code highlighting produced by actipro codehighlighter (freeware)
http://www.CodeHighlighter.com/

--> response. write into bytes

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.