mjacobsca
October 13th, 2006, 06:54 PM
Hello,
I'm new to ASP.NET. I've been programming with J2EE for some time now, and I have 5 questions about ASP best-practices and conventions. Thanks in advance for your answers!
1) I've noticed that the web controls cause a post back quite often to achieve dynamic behavior. It seems to me that unnecessary post backs will be problematic and inefficient. Do people try to restrict the post to a single submit button, and code other actions in javascript? I've been using javascript for years, so I am unsure as to how much goes in the code behind page and how much I should keep doing in javascript. Any thoughts here would be appreciated.
2) When creating the web controls, there are pre-defined styles. Is it easy to just attach a class to these controls instead? When I tried this, the class name AND the styles from the control property dialogs were put in the asp tag. What is the best way to handle this? I want my sites to be able to theme the application themselves, so customizability is key here.
3) I think I know the answer to this, but I'll ask anyway. Are variables in the code behind page shared with other calls to the same page? I'm planning on having a base class for my code behind pages, and I want some variables in this class so they are available to all, but I don't want them shared between different requests. My hunch is that they are NOT shared, but I just want to make sure.
4) How much javascript is acceptable with the ASP pages? I'm used to using a lot, and now it seems many behaviors are expected to be placed in code behind. Is the use of javascript considered "old school"?
5) If I want to validate user errors individually for each control, will the built-in validation put all errors in one message box? Or will the user see 5 alerts per page?
Michael
I'm new to ASP.NET. I've been programming with J2EE for some time now, and I have 5 questions about ASP best-practices and conventions. Thanks in advance for your answers!
1) I've noticed that the web controls cause a post back quite often to achieve dynamic behavior. It seems to me that unnecessary post backs will be problematic and inefficient. Do people try to restrict the post to a single submit button, and code other actions in javascript? I've been using javascript for years, so I am unsure as to how much goes in the code behind page and how much I should keep doing in javascript. Any thoughts here would be appreciated.
2) When creating the web controls, there are pre-defined styles. Is it easy to just attach a class to these controls instead? When I tried this, the class name AND the styles from the control property dialogs were put in the asp tag. What is the best way to handle this? I want my sites to be able to theme the application themselves, so customizability is key here.
3) I think I know the answer to this, but I'll ask anyway. Are variables in the code behind page shared with other calls to the same page? I'm planning on having a base class for my code behind pages, and I want some variables in this class so they are available to all, but I don't want them shared between different requests. My hunch is that they are NOT shared, but I just want to make sure.
4) How much javascript is acceptable with the ASP pages? I'm used to using a lot, and now it seems many behaviors are expected to be placed in code behind. Is the use of javascript considered "old school"?
5) If I want to validate user errors individually for each control, will the built-in validation put all errors in one message box? Or will the user see 5 alerts per page?
Michael