New concepts - 2 - web forms [posted by
dotnetter
169 days ago
- 66 views]
The next initially strange-seeming concept you have to take on-board when moving from Coldfusion to C# is that of WebForms.
A "WebForm" is exactly what the name suggests. It is a html/aspx page with a form on it. How these differ from web pages you may have designed and built before is that you can only have ONE form tag on a page!
Initially, this is very confusing. I was used to having multiple forms on a page. For example: one form for login box, another for registration form and another for a search box perhaps.
In C#, you'll have to handle all three of these through a SINGLE form - which USUALLY calls the same page again to submit.
This isn't as dreadful as it may seem, because instead, you give all your submit buttons IDs and when you click them, C# knows which one you pressed, and you can then handle each form sumbission differently.
In addition to this, you get into a habit of posting back to the same page. In C# this is called a 'postback'. You can detect a postback simply by doing: if (Page.IsPostBack==true) {
//handle various form post methods here
}
0 comments | 66 views
tags:
c# web forms, postback, c# concepts,
bookmark this page to del.icio.us
Comments
No comments posted yet, why not be first?
You must log in or register to post a comment.