473,385 Members | 1,720 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,385 software developers and data experts.

confirm false value does not stop post back to server

Ok so I have a DataGrid of which I have added checkboxes for every row, and a delete button.

All of the code for checking and actually deleting the rows runs fine, however, the javascript I have attached to this asp button does not seem to be running properly. Its a confirm box that while the code runs properly. A false value does not stop the post back to the server. Any ideas on this would be greatly appreciated. If you would like to see the code just let me know. But I've checked, and double checked it for correctness in placement and syntax...

I would really prefer to not have to make my asp button invisible and attach the javascript to an HTML button. Again, any help is most welcome.
Aug 2 '07 #1
5 7978
epots9
1,351 Expert 1GB
u could set the properties of your asp button not to submit and then after the javascript confirm says its good, then the javascript should submit your form.
Aug 2 '07 #2
Well, after posting that I decided to try it the other way. Attaching the javascript to a HTML button, and then just having the javascript call my asp button. However, my deletion code, even if they click cancel and it skips the code that connects the javascript to my asp button. Rows are still being deleted. I see no connection between my delete method, and my java function and yet my method is still running.
My frustrations seem to only be beginning.
Aug 2 '07 #3
acoder
16,027 Expert Mod 8TB
Changed the thread title. Please use a good thread title. Thanks!
Aug 3 '07 #4
acoder
16,027 Expert Mod 8TB
... If you would like to see the code just let me know....
Yes, please.
Aug 3 '07 #5
First off, and Im have not taken offense to the change in my thread title. One, thats just my personality. I tend to be a little crazy and try to keep things fun. Two, looking back on it, that probably was not the best choice for the title and I do apologize for that. I'll keep that in mind for future reference.

In the Page Load
mDeleteBtn.Attributes.Add("onclick", "ConfirmDelete();");


javscript
<script type="text/javascript">
function ConfirmDelete()
{
var r=confrim"Are you Sure you Want to Delete"))
if (r==true)
{
__doPostBack(mDeleteBtn);
}
else
{
}
}
</script>


Now, I have fixed this problem by adding an HTML button and removing the add attribute. However, I still am not sure why it was posting back even without hitting that code. It would literally skip over the post back, and still post back. I have since realized that the post back was not a good idea either. Im now getting the asp button by id and calling the click event. But this way did work, until it decided not to.
Aug 3 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: JohnSouth104 | last post by:
Hi I want to warn the user that changing the selected item in a pull-down will clear some data he has already entered in a file download box. I've tried using confirm() to return true or false...
2
by: SS | last post by:
Hi newbie ASP.NET coder here... Can someone tell me what I'm missing or what I'm doing wrong here? I'm trying to validate based on a javascript confirm. The confirm box is just an ok/cancel. ...
7
by: Grey | last post by:
how to design confirm message box, like Javascript Confirm box, in ASP.NET?? if the user click "YES" in the confirm box, i need to do something, else do other things. Do I need to have javascript...
13
by: Chris | last post by:
I can create Javascript confirm message boxes during page creation, etc adding them to the button attributes (many good posts on this!). But how can I add this event after the button is pressed? I...
1
by: freshRecruit | last post by:
Hi, I am having a problem, and is driving me nuts and my deadline is fast approaching. Please do help me.. This is a webapplication with a usercontrol which has some buttons for adding,...
5
by: rodchar | last post by:
hey all, in my page load i'm attaching a javascript confirm message to my save button. my problem is i have some client side validation which uses a Custom Validator web control and when i make...
5
by: robert | last post by:
I have a dropdownlist with the autopostback set to true. I want the user to be confirm whether they do indeed want to change the value, which on post back fires a server side event...
8
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form...
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.