Feb 21, 2008

Page Load Function Tips

Get some idea or tips from others work in their page load():

Protected Sub Page_Load(ByVal s As Object, ByVal e As System.EventArgs)

' Registering external javascript file, so that we can have more neater js file management.
Page.ClientScript.RegisterClientScriptInclude("ethan", "ethan.js")

' Cache Setting, I just know about
' ASP Caching can be set manually on the virtual directory property
Response.Cache.SetCacheability(HttpCacheability.NoCache)

' Auto-find control and set focus to it;
' I just know got such a syntax, which really near to human language syntax "IsNot"
' and about ClientID property which is very useful in some case.
If (tblpwdDetailsView.FindControl("fullName") IsNot Nothing) Then
Page.Form.DefaultFocus = tblpwdDetailsView.FindControl("fullName").ClientID
End If

' The way they check for QueryString exist or not
If (Not Page.IsPostBack) Then
If (Request.QueryString.Count > 0) Then
......




No comments:

Post a Comment