Beginner questions

C

Chris

Hi all,

I've recently started learning ASP.Net and have a few questions mostly
regarding best practice.

As postback uses JS is it normal practice to check if the browser
supports/has JS enabled to ensure the site functions correctly? I know the
vast majority of browsers probably have JS installed and enabled, but I'd
still like to know what the standard technique is for doing this.

Secondly, I've been playing about with multiview and ASP hyperlink objects.
For a small site (Around 5 pages) is the use of multiview overkill? Is it
mainly used for wizards etc? This relates to the first question too. By
using this technique (all hyperlink objects firing a postback), any browser
without JS wouldn't beable to view the site.

Regards,

Chris
 
S

S. Justin Gengo [MCP]

Chris,

Actually the way post backs are set up they will still work even if
javascript is disabled in a browser. That goes for buttons. Something like
an autopostback on a drop down list won't work with javascript disabled.

You'll want to be careful using a postback event to change pages. While this
won't cause problems for users who want to navigate your site it will keep
the site from being spidered by search engines correctly. If this is a
public website and you want search engines to be able to catalog its pages
you should use good old hyperlinks to trigger page changes. Most search
engines will follow different query strings tacked onto a hyperlink.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
P

Peter Rilling

Not all postbacks happen with JS. Only things like the dropdown list or
other non-<input> controls. If all you have is a simple submit button, then
JS can be turned off and still send postbacks. I personally have never
checked to see if a browser supports JS. My guess is that they do not since
it most likely so widely supported and used (aside from the few paranoid
people). But if you want to ensure the user is told they need JS before
they actually try to do something, then that would not be a problem.

From my experience, it is usually best to have each page their own physical
page (unless they have similar behavior and layout). If you use the
multiview, the server has to load the object model for all pages, regardless
of whether or not you view the page. This can unnecessarily use processing
cycles. It can also be harder to maintain as you cannot just target a fix
for a particular page but rather have to sift through the code that
generates all the views to get to your bug.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top