JQuery :: Unable To Stop Button's Code Behind?

Feb 21, 2011

Currently users select a record in a gridview and click on the delete button. Delete button passes certain variables to identify the record, makes a SQL connection and then deletes the record by executing a stored procedure. This is way the delete button's code behind works. Now we need a confirmation box if a certain flag is False. If the users select YES then they should be able to delete any way otherwise clicking on Cancel should stop the operation. I don't want to use the onClientClick event of the button like many examples on Web show, instead I am using the jQuery, that uses the button ID and pops up a confirmation dialog. The issue I am having is even if the Cancel button on the confirmation dialog is clicked it still goes on to run the code behind, executes the stored procedure and deletes the record. The browser being used is IE 7.0, how do I stop the button from running the code behind in the button_click event if they select cancel?

I have tried return false, e.preventDefault();event.propagation, event.returnValue = false etc but can't stop it. Here is the jQuery, that goes to the webservice when clicked and determines whether to display the confirmation or not when another stored procedure returns the record count of 0 or more. Like I said it works fine in getting the flag value from the SQL but does not stop at the client level and continues on to the code behind of btnDelete.

$(function() {
$("#btnDelete]").click(function(e) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebServices/myServices.asmx/ConfirmDelete",
data: "{}",
dataType: "json",
error: function(req, msg, err) { alert(req, msg, err); },
success: function(msg) {
if (msg.d == 0 && !confirm("Do you wish to delete this record?")) {
event.preventDefault();
return false;
event.returnValue = false;
}
}
});
});
});

View 7 Replies


Similar Messages:

Web Forms :: Using Image Button In But Unable To Stop It?

Jan 8, 2010

Im using a image button in my usercontrol to avoid postbacks on its click event.but im unable to stop it .

This usercontrol will be loaded into an ASP page on its load.

<input type="image" src="../Images/plus.gif" onclick="addElement(TopFrame1_PnlAxnCds1,TopFrame1$ddlMitigtAxnCd11);" name="AddMore"/>

View 3 Replies

JQuery :: Adding Play / Stop Button To A Simple Slide Show?

Sep 24, 2010

I got the following code with the help of raghav khunger and I wanna add a play and stop button on it to cycle the pictures orderly and stop them. how can I do that?

[Code]....

View 6 Replies

Web Forms :: Unable To Fire JQuery Alert When Clicking On Link Button Inside GridView

Mar 12, 2012

<head runat="server">
<title></title>
<style type="text/css">
BODY, HTML
{
padding: 0px;
margin: 0px;
}

[Code] ....

My GridView is as follows

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" OnRowEditing="GridView1_RowEditing" OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting" Width="574px">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField HeaderText="ID">

[Code] ....

But I am unable to get the required alert ...

 I am using alerts from this site [URL] ....

View 1 Replies

.net - C# Unable To Stop The Process?

Apr 4, 2011

I developed a Webpage in ASP.NET - the page has a button that starts a DOS-Program on click.Here is the Code:

if (!String.IsNullOrEmpty(endTime))
{
Process p = new Process();[code]....

The code works fine and starts the Process.Now the Problem: I click on the button and the process starts (I see this in the database) and the program works fine, however, I want to stop the process now, but don't know how.

There isn't a DOS-Window where I can click "CTRL + C" or something.What can I do to stop the process?And which User is used for starting the Process?

View 2 Replies

JQuery :: Need A Confirm Button When Delete File So I Changed Code?

Dec 27, 2010

i am using jquery upload plugin- jquery.MultiFile.js in my project to upload multiple files in this file now i need a confirm button when delete file so i changed code

if(!MultiFile.trigger('onFileRemove', slave, MultiFile)) return false;

View 1 Replies

Paging Creates Extra Page / Unable To Stop It

Nov 29, 2010

I am performing "semi"-custom paging for my dynamic LINQ query. However, if the number of results returned exactly fill the page, then I wind up with one extra page that's empty and I can't figure out why. i.e. if I have a page size of 15 and 14, 21, 101, etc. items then everything is fine. However, if I have 15, 30, 45, 60, etc. then I get one extra blank page and I've been unable to make it stop. Anyone have some ideas except to add a new record when I see we're sitting on a multiple of the page size?

I write out the paging control like this and it loops through one time too many if the last page is full...

[code]....

View 4 Replies

JQuery :: Image Button Not Giving Postback In Google Chrome, Same Code Is Working Fine For IE8

Jul 6, 2010

Image button not giving postback in Google Crome, The same code is working fine for IE8 and Firefox 3.6.6

<asp:ImageButton ID="btnlogin" runat="server" ImageUrl="~/images/log.jpg"
onclick="btnlogin_Click" OnClientClick="return confirmAction(this)" />

View 4 Replies

Possible To Stop Event Using JQuery/javascript?

Sep 9, 2010

I have some code like below in an aspx page:

[code]....

I had thought that returning false would keep my asp.net OnClick even from firing, but it still does. I've confirmed that it is getting to the return false section of code using alerts. Is there anything I can do to stop it from firing using jQuery/javascript?

View 2 Replies

Stop Postback After Using JQuery Dialog?

Dec 6, 2010

I have a JQuery Dialog that is opened when a button is clicked. The first time around, it should do a postback, but when the dialog closes and I click the refresh button of the broswer, it sends the data again and duplicates the data I just entered. Should I add a return false somewhere so it doesn't postback when the dialog is closed. Here is the script:

[code]....

View 3 Replies

JQuery :: How To Stop Resizing The Resizable()

Dec 31, 2010

I am using a resizable() event and I want to bound the max height and max width within another div element. Containment option does not work. So, I used the resize event. I am able to trap the condition where the resize goes beyond the container, but not able to stop the resize.

[Code]....

View 2 Replies

JQuery :: Stop Event Propagation?

Sep 27, 2010

I have two click handlers hooked on the click of an anchor. I want the first handler to be able to cancel the propagation of the event to the 2nd handler. Also, I want to be able to cancel the default click behavior of the anchor.

Problem is, StopPropagation is not found as a method on the "e" object passed to the event handler. Why is StopPropagation not found?

[Code]....

View 6 Replies

C# - Stop SQL Query Execution From .net Code

Jan 24, 2011

I'm executing one stored procedure from the '.net' code. Since there is a lot of data, it is taking too much time to execute. Is there any way to stop this execution from the c# code?

In other words, if we execute the query from database itself, there is a option to stop its execution but in the code is it possible?

View 2 Replies

Web Forms :: Stop An Application From Code Behind?

Mar 18, 2011

I'm going to check the database schema at Application_Start event handle in the Global.asax file. If something wrong, I hope to stop the application instead of just catch an exception.

View 2 Replies

Web Forms :: How To Stop Code Interrupt

Jan 10, 2011

I have a repeater and a user control on my page, when any of the items in the repeater are selected this refreshes the user control accordingly. However I found that if I selected another item before the page/user control had finished to load it produced an error, when left to let the page/control fully load and reselect no error.Clearly this is interrupting the code before its finished, can I stop this from happening by doing some sort of check to see if the user control has finished loading?

View 3 Replies

JQuery UI Selectable Stop Event Doesn't Work In IE

Jun 22, 2010

I have a JQuery select component and a javascript function to handle the stop event:

[code]....

The script works fine in firefox and chrome but not in IE7/8. It is normally supposed to send a string to the openid_identifier textbox once the google or yahoo select box is clicked.

View 3 Replies

Web Forms :: Stop Inserting Duplicate Value In Ddl Using Code Behind

Aug 4, 2010

my ddl1 and ddl2 in update panel so i want to insert item in ddl using following condition. It is working fine but when you choose ddl2 more than one then it insert item every time meand duplicate value and populate ddl1 every time.

protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList2.SelectedValue=="1" )
{
DropDownList1.Items.Insert(0, new ListItem("first", "1"));
DropDownList1.Items.Insert(1, new ListItem("Second", "2"));
DropDownList1.Items.Insert(2, new ListItem("Third", "3"));
}
else if (DropDownList2.SelectedValue == "2" )
{
DropDownList1.Items.Insert(0, new ListItem("first", "1"));
DropDownList1.Items.Insert(1, new ListItem("Second", "2"));
}
}

View 4 Replies

How To Set The Line In Code For Debug And While Running It Does Not Stop

Feb 17, 2011

I set the line in code for debug and while running it does not stop there. So I use System.Diagnostics.Debugger.Break(). Sometimes it stops and sometimes the debugger shows a blank screen. All use the same inputs.

View 2 Replies

Web Forms :: How To Stop Executing Code Behind File

Sep 7, 2010

Using Javascript i am validating a textbox data.when validation fails i need to stop executing code behind file.How to proceed.

View 3 Replies

MVC :: Stop Code From Executing In Initialize() Method?

Jul 29, 2010

in my controller I have code that validates URL. if not valid I want it to 301 redirect:

[code]....

but this still goes continues on and executes any code after. how would i simply 301 redirect? and NOT continue to process any code after break;?

View 3 Replies

Javascript - Stop IFrames To Load From Code Behind?

Nov 18, 2010

I have an ASP.NET page and have a couple of linkbuttons and Iframes. The pages in side of these IFrame take long time to load, I want the user to navigate to another page by clicking one of the linkbuttons. Now, it looks like it is waiting for the the iframes to finish loading when i click on a link button, the page is still trying to load (instead of navigating to different page).

Is there any way I can stop the iframes to load and go to another page?

View 1 Replies

How To Stop Button Postback With If Function

Jul 6, 2010

i have a button that will check whether textbox1.text is empty or not. I have put a if function inside the btn_click event and look like this

Code:

If TextBox1.Text <> Nothing Then
''Will COMMIT if everything OK
MsgBox("OK Popup userCon2")
Else
End If

May i know what shpuld be the code inside the else statement if i do not want the button to create a postback and just do nothing?

View 3 Replies

JavaScript - Jquery Dialog Stop Closing When Error Occurred

Oct 15, 2010

I am using the jQuery Dialog in ASP.NET. I have it working fine with the exception of when I click the OK button in the dialog and if an error occurred I want to show the error in the label. By the time the dialog closing event is fired it is too late. How do I still show the dialog if an error has occurred. I don't want to close the dialog when there is an error.

[code]....

View 1 Replies

How To Automatically Stop Debugging When Starting To Edit Code?

Feb 25, 2010

I am working on an ASP.NET project. When I am debugging, I often want to switch back from my browser to Visual Studio (2008) and edit some code. Visual Studio then won't let me edit the code, unless I explicitly quit debugging first.

Is there any way to configure Visual Studio such that is automatically stops debugging and allow me to edit the code, or do I have to stop it manually each and every time?

Disabling Edit and Continue does allow me to edit the code, but this does not force VS to stop debugging...

View 1 Replies

Autostart Youtube In Code Behind And Play Videos Non Stop?

Mar 3, 2010

[Code]....

[Code]....

[Code]....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved