Wind shadow ASP. NET basics 3 Web server controls (2)

Source: Internet
Author: User
ArticleDirectory
    • File Size upload restrictions
Review above

We talked about various server-side controls, which brought us a lot of convenience in development. Let's continue to look at other server controls.

 

1. fileupload

 

Anyone who has learned HTML knows that the upload control requires <input type = "file"/>. Of course, we also have corresponding server-side controls.

We only need to determine whether a file is uploaded and save it.

 
1:Protected VoidButton#click (ObjectSender, eventargs E)
 
2:{
 
3:StringSavepath =@ "D: \ uploads \";
 
4: 
5:If (! Directory. exists (savepath ))
 
6:Directory. createdirectory (savepath );
 
7:If (fileupload1.hasfile)
 
8:{
 
9:String filename = fileupload1.filename;
 
10:Savepath + = filename;
 
11:Fileupload1.saveas (savepath );
 
12:Label1.text = "The uploaded files are:"+ Savepath;
 
13: 
14:}
 
15:Else {
 
16:Label1.text = "the file to be uploaded is not specified ";
 
17:}
 
18:}
 
 
File Size upload restrictions

You can use web. config to configure the maxrequestlength = "10000" attribute. the upload will fail if the uploaded content exceeds the set value. We can also set the timeout time.

2. hyperlink Control

It is actually the most common a mark in HTML.

Common attributes: navigateurl = "http://www.baidu.com" imageurl = "" text = "" target = "_ blank"

Navigateurl Jump path
Imageurl Image carrier
Text Text carrier (image text 2 select 1)
Target Open Method _ blank on the New Page
3. panel control

The Panel space is a container control provided by the ASPNET control. Finally, it is converted into a div element.

Common attributes:

Horizontalalign Alignment of the stator control in the panel
Wrap Specify whether the content in the panel is automatically switched to the next line when the width is exceeded or truncated.
Scrollbars Add a scroll bar for content that exceeds the region
Groupingtext Display the border and title. This attribute will not display the scroll bar.
Visible Visible or not

 

Summary

We have explained some basic attributes and usage of Web standard server controls.

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.