Hiddenfield, linkbutton, literal

Source: Internet
Author: User
Tags passthrough

Hiddenfield,
Linkbutton,
Literal

HiddenfieldIt provides a way to store information on pages, which is similar to other controls, but is not displayed or occupied. It still cannot store sensitive information such as passwords because it is stored in HTMLSource codeIs visible.

< ASP: hiddenfield ID = "Hiddenfield1" Runat = "Server" Value = "Hide Field Values"   /> Linkbutton The usage of this control is similar to that of the button, which is the integration of Hyperlink and button.

< ASP: linkbutton ID = "Linkbutton1" Runat = "Server" Onclick = "Linkbutton#click" > Linkbutton </ ASP: linkbutton > Protected   Void Linkbutton#click ( Object Sender, eventargs E)
{
Linkbutton1.text = Hiddenfield1.value;
// Extract values in daily use (such as registration) and send them along with the form
}

Literal, Which is rarely used .. NET 2.0
The literal control represents one of the several options used to add content to a page. For static content, you can add tags to the page as HTML without using containers. However, to add content dynamically, you must add the content to the container. Typical containers include label controls, literal controls, panel controls, and placeholder controls.
The mode attribute of the literal control: specifies how the control handles the added tag.
1. Transform: any tag added to the control is converted to adapt to the protocol of the requesting browser. This setting is useful for rendering content to mobile devices that use other protocols other than HTML.
2. passthrough: any tag added to the control will be displayed in the browser as is.
3. encode: any tag added to the control is encoded using the htmlencode method, which converts HTML encoding to its text representation. For example, the <B> tag is displayed as & lt; B & gt ;. Encoding is useful when you want the browser to display without interpreting the mark. Encoding is also useful for security and helps prevent malicious tags from being executed in the browser. This setting is recommended when strings from untrusted sources are displayed.

Use the transform mode: < ASP: literal ID = "Literal" Runat = "Server" Text = '<HR > < I > [Aiodine] (2008); "Heihei" < BR > < P > </ I > '> </ ASP: literal >

Use passthrough mode:

< ASP: literal ID = "Liter_3" Runat = "Server" Mode = "Passthrough" Text = '<HR > < I > [Aiodine] (2008); "Heihei" < BR > < P > </ I > '> </ ASP: literal >

Encode mode:

< ASP: literal ID = "Literal4" Runat = "Server" Mode = "Encode" Text = '<HR > < I > [Aiodine] (2008); "Heihei" < BR > < P > </ I > '> </ ASP: literal >

Label in Normal Mode:

< ASP: Label ID = "Label1" Runat = "Server" Text = '<HR > < I > [Aiodine] (2008); "Heihei" < BR > < P > </ I > '> </ ASP: Label >

The label is displayed by decoding the server. htmlencode method:

< ASP: Label ID = "Label2" Runat = "Server" Text = '<HR > < I > [Aiodine] (2008); "Heihei" < BR > < P > </ I > '> </ ASP: Label > Protected   Void Page_load ( Object Sender, eventargs E)
{
Label2.text = Server. htmlencode (label2.text );
}

How can I try the specific display?

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.