Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Professional ASP.NET 4.5 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4.5 in C# and VB by Jason N. Gaylord, Christian Wenz, Pranav Rastogi, Todd Miranda, Scott Hanselman; ISBN: 978-1-1183-1182-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 8th, 2013, 07:44 PM
Authorized User
Points: 175, Level: 3
Points: 175, Level: 3 Points: 175, Level: 3 Points: 175, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2013
Location: St.Petersburg, Russia
Posts: 36
Thanks: 1
Thanked 4 Times in 4 Posts
Default Turning off client-side validation

Chapter 6, page 224-225

"Turning off client-side validation"

This section does not mention a possibility to turn off client scripts with a single attribute in the Page-directive:

<@ Page ClientTarget="downlevel"

It seems to be easier and faster than writing
Code:
foreach (BaseValidator bv in Page.Validators)
{   bv.EnableClientScript = false;   }
Is it considered to be a bad practice to use "ClientTarget"-attribute?

MSDN:
http://msdn.microsoft.com/en-us/libr...enttarget.aspx
Reply With Quote
  #2 (permalink)  
Old July 9th, 2013, 11:21 AM
Imar's Avatar
Wrox Author
Points: 71,561, Level: 100
Points: 71,561, Level: 100 Points: 71,561, Level: 100 Points: 71,561, Level: 100
Activity: 80%
Activity: 80% Activity: 80% Activity: 80%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,002
Thanks: 79
Thanked 1,574 Times in 1,551 Posts
Default

Hi there,

That settings turns off more than just client side validation. With that setting on, ASP.NET assumes the browser doesn't support JavaScript and will use scriptless version of other control and content as well: http://msdn.microsoft.com/en-us/libr...enttarget.aspx

I wouldn't recommend using it just to turn off client side validation.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Oleg Kolpashchikov (July 9th, 2013)
  #3 (permalink)  
Old July 9th, 2013, 03:25 PM
Authorized User
Points: 175, Level: 3
Points: 175, Level: 3 Points: 175, Level: 3 Points: 175, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2013
Location: St.Petersburg, Russia
Posts: 36
Thanks: 1
Thanked 4 Times in 4 Posts
Default

That's a good point - other controls that normally would be rendered with JS - will be rendered differently.
I'll do some testing for myself to clarify it.


Thanks!
Reply With Quote
  #4 (permalink)  
Old July 10th, 2013, 09:43 PM
Authorized User
Points: 175, Level: 3
Points: 175, Level: 3 Points: 175, Level: 3 Points: 175, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2013
Location: St.Petersburg, Russia
Posts: 36
Thanks: 1
Thanked 4 Times in 4 Posts
Default

UpdatePanel does not work properly with ClientTarget="downlevel" - it does a postback every time I change something inside it, like change a date on the calendar.

"Normal"-version brings in 3 JS-files, "downlevel" version only 1 JS-file (ASP.NET AJAX)
Reply With Quote
  #5 (permalink)  
Old July 11th, 2013, 02:23 AM
Imar's Avatar
Wrox Author
Points: 71,561, Level: 100
Points: 71,561, Level: 100 Points: 71,561, Level: 100 Points: 71,561, Level: 100
Activity: 80%
Activity: 80% Activity: 80% Activity: 80%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,002
Thanks: 79
Thanked 1,574 Times in 1,551 Posts
Default

Exactly; ASP.NET assumes this downlevel browser doesn't support it. While it still renders some JavaScript, I don't know.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is client-side validation in ASP.NET 2.0 possible? jacob ASP.NET 2.0 Basics 6 April 10th, 2007 05:07 AM
Client Side Validation anujrathi ASP.NET 1.0 and 1.1 Professional 1 June 17th, 2006 10:23 PM
checkbox validation on client side using Javascrip sansircar ASP.NET 1.0 and 1.1 Professional 0 October 17th, 2005 07:43 PM



All times are GMT -4. The time now is 08:46 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.