Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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
 
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old September 27th, 2006, 10:26 AM
Friend of Wrox
 
Join Date: Apr 2005
Location: Fort Walton Beach, FL, USA.
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar:
Well ! Its been over two months since getting your last word on this topic. I had to attend to fixing an old app that was high priority but more importantly I think I have found the answer to my basic question. To re-iterate: we were tackling the issue of validation client side vs. server side, and you stated that server side is the preferred.

I have discovered Ajax/Atlas and am going thru "Foundations of Atlas" by Laurence Moroney.

Basically, Atlas will allow me to do the bulk of the validation (and any other UI tier adjustment) on the client side without ever having to do a round trip to the server. Thus, I can do all the validations, types, presence, range, etc. before the data ever leaves the client.

To be sure tho in view of your last comments, I will preserve the serverside validations and some other processing on the server to insure that nothing bad happens to the data while being sent to the server.

I can see that Ajax/Atlas is going to **revolutionize** website apps in that with a bit more development, the days of needing to send an entire page to the server and back to do some simple thing are going to end. In its place much of the server side functionality can be done client side beforehand. And most importantly, only data that changes needs to be sent to the server -- a much smaller amount resulting in substantially faster turn around time.

Regards,

VV


  #12 (permalink)  
Old September 27th, 2006, 01:13 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Right, so you *do* have that mystical month that falls between August and September. Hmmmm..... ;)

I never said server side is preferred. I said server side is essential / critical, and you should consider client side validation as well, mainly as a gesture to your users. If you like your users, and you want them to like you, and protect your system at the same time, you should implement both.

Atlas (or should we say the Microsoft AJAX Library now) does indeed throw new and exciting possibilities in the mix. It allows you to have server side validation, with a client side look and feel. This opens up possibilities to much more advanced server side validations (database look ups, web services, whatever) and still present a snappy user interface.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #13 (permalink)  
Old December 4th, 2006, 02:40 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar

I have a similar but different issue.I am using confirmation on exit(of any kind) window.onbeforeunload.But this gets fired even on the asp:button which is posting some data to the DB through SP.Is there a way that i can bypass this onbeforeunload event when i click asp:button.Here is what i am trying and also the error i am getting.
**************
<html>
<head>
<script language="JavaScript">
  var needToConfirm = true;

  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    if (needToConfirm)
      return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
  }
</script>
</head>
<body>
<form>
<asp:button Runat="server" Text="Save" onclick="needToConfirm = false;" ></asp:Button>
</form>
</body>

</html>
**************
The error i get is
 CS1026: ) expected
****************
Thanks
Kamal
  #14 (permalink)  
Old December 4th, 2006, 05:27 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

onclick is a *server side* event that tries to run C# code.

I think you're looking for OnClientClick instead....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #15 (permalink)  
Old December 4th, 2006, 05:40 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,
I tried onClientClick as well.But nothing happens.The onbeforeunload event is still fired onclick.

Thanks for help
Kamal
  #16 (permalink)  
Old December 4th, 2006, 06:01 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

How does the final HTML code in the browser look like?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #17 (permalink)  
Old December 4th, 2006, 06:10 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar

This is my HTML .The web page is for testing purpose only so it just has one asp:button.
**********
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        <script language="JavaScript">
  var needToConfirm = true;

  window.onbeforeunload = confirmExit;
  document.all["Button1"].onclick ="needToConfirm = false;" ;


  function confirmExit()
  {
    if (needToConfirm)
      return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
  }
        </script>
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
                Text="Button" ></asp:Button>
        </form>
    </body>
</HTML>
************
The actual web Page has lots of other controls and data in Data Grid that when button is clicked is posted to the Data Base via Stored Procedure.That is where i want to bypass onbeforeunload event.
I hope i make sense.

Thanks
Kamal
  #18 (permalink)  
Old December 4th, 2006, 06:15 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I meant the final HTML in the browser after the page has been rendered, not the source of the ASPX page.

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
  #19 (permalink)  
Old December 5th, 2006, 09:21 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,
I am sorry.I misunderstood you.Here is how HTMl looks like
**************
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"content="http://schemas.microsoft.com/intellisense/ie5">
<script language="JavaScript">
  var needToConfirm = true;

  window.onbeforeunload = confirmExit;
  document.all["Button1"].onclick ="needToConfirm = false;" ;


  function confirmExit()
  {
    if (needToConfirm)
      return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
  }
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form name="Form1" method="post" action="WebForm1.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDw5NjU1MTU1Ozs+ZMe/YzNJ8mHHmvf5Yc5QSvBQljk=" />

<input type="submit" name="Button1" value="Button" id="Button1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" />
</form>
</body>
</HTML>
****************************
And the footer bar on window always tell me that its done with error on page.I hope this is what you want.

Thanks
Kamal
  #20 (permalink)  
Old December 5th, 2006, 09:32 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

I don't see the results from OnClientClick in the final HTML, nor in the original ASPX. You need something like this:

<asp:Button id="Button1" OnClientClick="needToConfirm=false; return true;" .... />

Does that work?

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
How to create a button in javascript in asp.net ? coolcoder2007 ASP.NET 2.0 Basics 0 October 26th, 2007 04:14 AM
In ASP,Client side javaScript code casimir Classic ASP XML 0 October 24th, 2005 12:24 AM
How to add client-side script to an ASP button BrianWren VB.NET 1 March 30th, 2005 05:27 PM
sessions wont persist bogins Beginning PHP 2 April 22nd, 2004 01:56 PM
ASP Upload - does object persist across pages? James Diamond Classic ASP Components 4 January 27th, 2004 09:41 AM



All times are GMT -4. The time now is 05:12 PM.


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