Exercise Summary of several common controls (radiobuttonlist, multiview, adratator, literal, and panel controls dynamically add text boxes)

Source: Internet
Author: User

1. radiobuttonlist common attributes: selecteditem. Text; Selected. text;
2. Common attributes of multiview: activeviewindex;
3. The adratator control mainly writes XML files.
For example:

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <advertisements xmlns = "http://schemas.microsoft.com/AspNet/AdRotator-Schedule-File"> <br/> <ad> <br/> <imageurl> ~ /Image/11.png</imageurl> <br/> <navigageurl> http://www.baidu.com </navigageurl> <br/> <alternatetext> ad for Baidu </alternatetext> <br/> <impressions> 50 </impressions> <br/> </Ad> <br/> <ad> <br/> <imageurl> ~ /Image/670_s.gif </imageurl> <br/> <navigageurl> http://www.zhangjiajia.com </navigageurl> <br/> <alternatetext> ad for Jiajia </alternatetext> <br/> <impressions> 100 </impressions> <br/> </Ad> <br/> <ad> <br/> <imageurl> ~ /Image/1530.gif</imageurl> <br/> <navigageurl> http://www.1234.com </navigageurl> <br/> <alternatetext> ad for 1234 </alternatetext> <br/> <impressions> 10 </impressions> <br/> </Ad> <br/> </advertisements> <br/>
4. response. Write (server. htmlencode ("<HTML>"); // encode it so that it can be output on the page.
5. Common Properties of the literal control: literalmode
Literal1.text = "this is <B> text </B> inserted dynamically ";
 
Literal1.mode = literalmode. encode; // encode it so that it can be output on the page
 
Literal1.mode = literalmode. passthrough; // Let it execute the label Function
6. Add a text box to the panel control dynamically:

 

 

Page code:
<Div>
<Asp: Panel id = "Panel1" runat = "server" backcolor = "lightgoldenrodyellow" groupingtext = "panel control"
Height = "50px" width = "300px">
Container used as the dynamically generated text box... </ASP: Panel>

</Div>
Generate textboxes: <asp: dropdownlist id = "dropdownlist1" runat = "server">
<Asp: listitem> 1 </ASP: listitem>
<Asp: listitem> 2 </ASP: listitem>
<Asp: listitem> 3 </ASP: listitem>
</ASP: dropdownlist>
Background code:
Int num = int. parse (dropdownlist1.selecteditem. value );
For (INT I = 0; I <num; I ++)
{
// Output the <p> tag on the page
Panel1.controls. Add (New literalcontrol ("<p> "));
Textbox T = new Textbox ();
T. Text = "textbox" + I. tostring ();
T. ID = "textbox" + I. tostring ();
Panel1.controls. Add (t); // Add the generated text box to the panel control.
}

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.