473,441 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

page validation help

Hi all,
I needed to have a validation to prevent someone from leaving the page if
they added anything to it. I have about 10 imagebuttons at the top of the
page for menu selections, and i wanted to have a warningmessage pop up if
they select any of those without clicking the save button first.
I put :
If session("save") = "no" then
ImageButton1.Attributes.Add("onclick", "return confirm('Are you sure you
want to exit without saving?');")
end if...
in the page load event , and it works, but it will always show this message
now.. even if they selected the save button.

I use session variables to determine if it's been clicked, and in the page
load i check to see if the session var. is what its suppose to be, but it
will still always show it nomatter what...
What should i do???
--
Ad****@hotmail.com
Nov 19 '05 #1
3 1390
Try to check for you logic and Ispostback event. Example:

Sub Page_Load
If Not IsPostBack
' Validate initially to force the asterisks
' to appear before the first roundtrip.
Validate()
End If
End Sub
chanmm

"ACaunter" <Ad****@hotmail.com> wrote in message
news:F4**********************************@microsof t.com...
Hi all,
I needed to have a validation to prevent someone from leaving the page if
they added anything to it. I have about 10 imagebuttons at the top of the
page for menu selections, and i wanted to have a warningmessage pop up if
they select any of those without clicking the save button first.
I put :
If session("save") = "no" then
ImageButton1.Attributes.Add("onclick", "return confirm('Are you sure you
want to exit without saving?');")
end if...
in the page load event , and it works, but it will always show this
message
now.. even if they selected the save button.

I use session variables to determine if it's been clicked, and in the page
load i check to see if the session var. is what its suppose to be, but it
will still always show it nomatter what...
What should i do???
--
Ad****@hotmail.com

Nov 19 '05 #2
Thanks for the quick reply,
I'm not sure if i could use the postback option, because there are other
buttons and dropdowns which are used on the page, so many postback will occur
before the user enters info and clicks save...
its for a schedule page, so i have if there is a textchange in any of the
textboxes, then it should pop up with a message if the user hasn't clicked
save..

"chanmmn" wrote:
Try to check for you logic and Ispostback event. Example:

Sub Page_Load
If Not IsPostBack
' Validate initially to force the asterisks
' to appear before the first roundtrip.
Validate()
End If
End Sub
chanmm

"ACaunter" <Ad****@hotmail.com> wrote in message
news:F4**********************************@microsof t.com...
Hi all,
I needed to have a validation to prevent someone from leaving the page if
they added anything to it. I have about 10 imagebuttons at the top of the
page for menu selections, and i wanted to have a warningmessage pop up if
they select any of those without clicking the save button first.
I put :
If session("save") = "no" then
ImageButton1.Attributes.Add("onclick", "return confirm('Are you sure you
want to exit without saving?');")
end if...
in the page load event , and it works, but it will always show this
message
now.. even if they selected the save button.

I use session variables to determine if it's been clicked, and in the page
load i check to see if the session var. is what its suppose to be, but it
will still always show it nomatter what...
What should i do???
--
Ad****@hotmail.com


Nov 19 '05 #3
I've played around with the session variables, and now i sort of get it to
work...
if i make changes to the schedule page, and don't save anything, then i can
leave and go to another page, do whatever else, and the next time i go back
to the schedule page it will give me the "Are you sure" message for the
previous time.. and the next time will be this time's messages... so it's
pretty much always back one..
Just sucks the info is already gone when you leave the page, so the late
message is useless...

"chanmmn" wrote:
Try to check for you logic and Ispostback event. Example:

Sub Page_Load
If Not IsPostBack
' Validate initially to force the asterisks
' to appear before the first roundtrip.
Validate()
End If
End Sub
chanmm

"ACaunter" <Ad****@hotmail.com> wrote in message
news:F4**********************************@microsof t.com...
Hi all,
I needed to have a validation to prevent someone from leaving the page if
they added anything to it. I have about 10 imagebuttons at the top of the
page for menu selections, and i wanted to have a warningmessage pop up if
they select any of those without clicking the save button first.
I put :
If session("save") = "no" then
ImageButton1.Attributes.Add("onclick", "return confirm('Are you sure you
want to exit without saving?');")
end if...
in the page load event , and it works, but it will always show this
message
now.. even if they selected the save button.

I use session variables to determine if it's been clicked, and in the page
load i check to see if the session var. is what its suppose to be, but it
will still always show it nomatter what...
What should i do???
--
Ad****@hotmail.com


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Raphael Gluck | last post by:
HI I am wondering if anyone can help me I added a little script to a form page, so that a couple of fields have to filled in. One contains an obligatory field for number data, one for regular...
7
by: Mike | last post by:
I've been trying for the past week to put a simple code together. I have done a LOT of searching, found scripts showing the functions I would like to use, however when I mix them it all goes wrong,...
3
by: Arun K | last post by:
Hi, I am creating a simple .aspx page to add some fields with validation. I have used different .NET validations like REquiredFieldValidator, RegularExpressionValidator and showed the summary...
4
by: PCH | last post by:
I've run into a big problem with Opera 7x users. It appears that most pages do not render the panels correctly, and form validation does not fire at all. I tracked down some threads about the...
2
by: Jeff Tolman | last post by:
Is there anyway for a Javascript routine to determine if the validators on its page are successful? What's happening is I'm adding a javascript routine to the Submit button of a page (to perform...
3
by: Jonas | last post by:
Hi! I have aspx-page where I use multiple panels to make room for more controls than would otherwise fit onto one page. On submit, the controls on all panels, visible or not, should be validated...
4
by: Lloyd Dupont | last post by:
I am writing a 'blog control' which, amongst other things, let you edit some HTML text. When it's submited back there are validation problem and to my... *Horrible Disbelief* it seems I can only...
0
by: karen987 | last post by:
This is an email form on an ASP page. I want to add validation before it submits, The current validation only checks "name, email, and content" (server side) if the spaces are empty. I need to add...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.