Click here to Skip to main content
15,906,816 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: With out postback Pin
saqib8220-Oct-06 0:49
saqib8220-Oct-06 0:49 
GeneralRe: With out postback Pin
Sankar Komma 20-Oct-06 1:19
Sankar Komma 20-Oct-06 1:19 
GeneralRe: With out postback Pin
saqib8221-Oct-06 9:05
saqib8221-Oct-06 9:05 
GeneralRe: With out postback Pin
ednrgc20-Oct-06 2:03
ednrgc20-Oct-06 2:03 
GeneralRe: With out postback Pin
saqib8221-Oct-06 8:59
saqib8221-Oct-06 8:59 
QuestionRegular expression Pin
rtorot19-Oct-06 16:29
rtorot19-Oct-06 16:29 
AnswerRe: Regular expression Pin
Guffa19-Oct-06 20:44
Guffa19-Oct-06 20:44 
Questionasp:button UseSubmitBehaviour = "false" with Confirm dialog box Pin
Omkar Ghaisas19-Oct-06 11:33
Omkar Ghaisas19-Oct-06 11:33 
Hi,
In my asp.net (C#) application, I am running a long running process on one asp:button's click. So for safety purpose, I set the UseSubmitBehaviour attribute = "false" and then disable the buttons on the page (using javascript) and then proceed with the process.

Before actually starting the process, I ask the user a confirmation, whether to proceed or not using Ok/Cancel box in javascript and then actually proceed with the process.

But I see that even if user clicks Cancel, the page still posts back and server side process starts to execute.How can I avoid this ?

For your reference, given below is the whole code

<asp:Button ID="btnSubmit" runat="server" UseSubmitBehavior="false" Text="SUBMIT" Width="100%" CssClass="BUTTON" OnClick="btnSubmit_Click"/>

On Page_Load()

{btnSubmit.Attributes.Add("onclick", "ConfirmSubmit('" + btnSave.ClientID + "','" +btnSubmit.ClientID + "','" +btnValidate.ClientID + "','" +btnCancel.ClientID + "','" +btnBack.ClientID + "','" +btnViewEntireRecord.ClientID + "')");

javascript function

function ConfirmSubmit(btnSave,btnSubmit,btnValidate,btnCancel,btnBack,btnViewEntireRecord)

{if( window.confirm("Are you sure you want to submit this data ?") == true)
{
event.cancelBubble = false;
window.history.forward(1);
btnSave=document.getElementById(btnSave);
btnSubmit=document.getElementById(btnSubmit);
btnValidate=document.getElementById(btnValidate);
btnCancel=document.getElementById(btnCancel);
lnkBack=document.getElementById(btnBack);
lnkViewEntire=document.getElementById(btnViewEntireRecord);
btnSave.disabled = true;
btnSubmit.disabled = true;
btnValidate.disabled = true;
btnCancel.disabled = true;
lnkBack.disabled = true;
lnkViewEntire.disabled = true;
return true;
}
else
{
event.cancelBubble = true;
return false;
}

What is the bug in this. Pls guide me.

Thanks and best regards
Confused | :confused: Omkar

AnswerRe: asp:button UseSubmitBehaviour = "false" with Confirm dialog box Pin
minhpc_bk19-Oct-06 14:45
minhpc_bk19-Oct-06 14:45 
QuestionCompiler Error Message: CS1010: Newline in constant Pin
sanju027619-Oct-06 5:55
sanju027619-Oct-06 5:55 
AnswerRe: Compiler Error Message: CS1010: Newline in constant Pin
Christian Graus19-Oct-06 7:22
protectorChristian Graus19-Oct-06 7:22 
GeneralRe: Compiler Error Message: CS1010: Newline in constant Pin
sanju027619-Oct-06 8:06
sanju027619-Oct-06 8:06 
GeneralRe: Compiler Error Message: CS1010: Newline in constant Pin
Christian Graus19-Oct-06 10:37
protectorChristian Graus19-Oct-06 10:37 
JokeRe: Compiler Error Message: CS1010: Newline in constant Pin
Guffa19-Oct-06 11:38
Guffa19-Oct-06 11:38 
QuestionOnline survey Pin
AlaaMahmoud18-Oct-06 21:17
AlaaMahmoud18-Oct-06 21:17 
AnswerRe: Online survey Pin
Christian Graus19-Oct-06 7:26
protectorChristian Graus19-Oct-06 7:26 
AnswerRe: Online survey Pin
saqib8219-Oct-06 23:48
saqib8219-Oct-06 23:48 
Questionmailto: Issue Pin
Brendan Vogt18-Oct-06 20:09
Brendan Vogt18-Oct-06 20:09 
AnswerRe: mailto: Issue Pin
J4amieC19-Oct-06 4:02
J4amieC19-Oct-06 4:02 
QuestionMemoryStream and array of byte (Urgent) [modified] Pin
Tridip Bhattacharjee18-Oct-06 19:15
professionalTridip Bhattacharjee18-Oct-06 19:15 
AnswerRe: MemoryStream and array of byte (Urgent) Pin
Paddy Boyd19-Oct-06 4:33
Paddy Boyd19-Oct-06 4:33 
GeneralRe: MemoryStream and array of byte (Urgent) Pin
shreekar19-Oct-06 19:42
shreekar19-Oct-06 19:42 
AnswerRe: MemoryStream and array of byte (Urgent) Pin
saqib8220-Oct-06 1:03
saqib8220-Oct-06 1:03 
AnswerRe: MemoryStream and array of byte (Urgent) Pin
saqib8220-Oct-06 1:03
saqib8220-Oct-06 1:03 
AnswerRe: MemoryStream and array of byte (Urgent) Pin
hectorpc200623-Oct-06 2:21
hectorpc200623-Oct-06 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.