Some ASP.NET tips

xiaoxiao2021-03-06  53

OpenFile Dialog in WebForm If you need a OpenFile dialog that opens the file on the browser, you can use HTML's INPUT to set its type to file:

Page_Load & ISPostback In the ASP.NET application, if you do some initialization operations when you need to display the page for the first time, you must judge the ISPOSTBACK property, for example:

Private Void Page_Load (Object Sender, System.EventArgs E)

{

IF (! this.ispostback)

{

// ... Initialize

}

}

Web Forms calls each other in ASP.NET applications, and if you need to implement Mutual calls like WinForm, the easiest way is to use the REDIRECT method of the Response object, for example:

Response.Redirect ("WebForm2.aspx"); parameter delivery between WebForms is just like Forms often need to intermittent parameters, and WebForm may also need to pass some status parameters, such as login page may need to pass the current username. Main page, you can use the HTTPSessionState type SESSION object, for example:

// A WebForm:

Session.Add ("UserName", txtusername.text);

// Another WebForm:

String shello = "Hello" session ["username"];

转载请注明原文地址:https://www.9cbs.com/read-116185.html

New Post(0)