Several ASP. NET skills

Source: Internet
Author: User

OpenFile Dialog in WebForm
If you need an OpenFile dialog box that opens a File in a browser, you can use the HTML Input to set its Type to File: <INPUT style = "Z-INDEX: 102; LEFT: 145px; WIDTH: 468px; POSITION: absolute;
TOP: 228px; HEIGHT: 25px "type =" file "size =" 58 "id =" txtFilePath ">




Page_Load and IsPostBack
In ASP. NET applications, if you need to perform initialization operations when the page is displayed for the first time, you must determine the IsPostBack attribute, such as private void Page_Load (object sender, System. EventArgs e)
{
If (! This. IsPostBack)
{
//... Initialize
}
}




Web Forms mutual calls
In ASP. NET applications, if you need to implement mutual calls like WinForm, the simplest way is to use the Redirect method of the Response object, for example: Response. Redirect ("WebForm2.aspx ");



Parameter transfer between webforms
Just as parameters need to be passed between forms, some status parameters may need to be passed between webforms. For example, Login page may need to pass the current UserName to Main page, in this case, you can use a Session Object of the HttpSessionState type, such as: // In A WebForm:
Session. Add ("UserName", txtUserName. Text );
// In another WebForm:
String sHello = "Hello" + Session ["Username"];

Related Article

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.