Confirmation Message Box with Replace and Cancel buttons

Hi,

 

I would like to seek help on how to create a confirmation message with Replace and Cancel buttons.  And also, how can I check if user clicked the Replace button. 

 

Thanks.

 

1
Crystal30
1/26/2009 10:47:31 AM
asp.net.client-side 24353 articles. 1 followers. Follow

4 Replies
1028 Views

Similar Articles

[PageSpeed] 51

Hi,

 You can create your own Cofirmation msg dialog. u require,
 div tag, with 2 buttons and text to display.
Make this div to display(visible) when u want and allow to user to 
click any of the button. if clicked 'cancel' set to 'return false;'
if clicked 'replace' call respective function() with ur required code in it  or set a global var. with value=True.
 There are sites provides u help on this. go and search.

--------------------------------
Happy Coding.
-1
raju
1/26/2009 11:15:28 AM

Hi,

You can use following javascript:

<script type="text/javascript">

function showConfirm(id)

{

if (confirm('Are you sure you want to ' + document.getElementById(id).value))

return true;

else

return false;

}

</script>

This is how you can call javascript on your both buttons.

Me.btnReplace.Attributes.Add("onclick", "javascript: return showConfirm('" & Me.btnReplace.ClientID & "')")

Me.btnCancel.Attributes.Add("onclick", "javascript: return showConfirm('" & Me.btnCancel.ClientID & "')")

Hope it will solve your problem.


Faraz Shah Khan
MCP, MCAD.Net, MCSD.Net, MCTS-Win/Web, MCPD-Web
Blog
-1
farazsk11
1/26/2009 11:18:02 AM

Hi,

I guess I misunderstood your problem in my last post. Here is an article I read some time back written by Haissam Abdul Malak (a very active user of this forum). Link of the article is http://aspalliance.com/1366_Building_a_Custom_Confirmation_Dialog_Box.all I believe it will give you some idea on how you can achieve your goal.

Hope it will help you out.


Faraz Shah Khan
MCP, MCAD.Net, MCSD.Net, MCTS-Win/Web, MCPD-Web
Blog
1
farazsk11
1/26/2009 11:35:46 AM

Hi,

Besides the approaches the above listed, you can also check AjaxcontrolToolkit ConfirmButtonExtender: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmButton.aspx

It will provide you a custom confirm window.

 

 



Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
1
Vince
1/29/2009 8:21:58 AM
Reply:

Similar Artilces:

How to set focus to "Cancel" button in the confirm message box?
Hi, I am using the following code to pop up a confirmation box: btnDelete.Attributes.Add("onclick", "if (confirm('Are you sure you want to delete this item?')){}else{return false}"); Could anyone let me know if there is a way to set the default focus to the "Cancel" button instead of the "OK" button? Thanks can't be done. sorry....

Firing server side validation & Client side confirm with a single button..
Hi All, I have a "Update" asp button. onclick of the button i need to check the server side validations like:if (!IsValidEmail(ctrlEmailAddress.TextBoxControl.Text.Trim())) {MessageBox.Show("Enter valid email address"); validateCheck = false; } After completion of this type of validations, i need to fire one javascript confirmbox saying "Are you sure you want to update this order?" with "Yes/No" options. All these things needs to be done in a single button click. Can any one help me to acheive this ..requirement?  -HemanthPlease rem...

Client side message box
hello,  I have a message box that pops out on the click of a button, asking what is the next step. If the user chooses Yes the application opens a word document to write, and if it clicks No just a read-only word document. I use this code DialogResult reply = MessageBox.Show(text, "Files", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (reply == DialogResult.Yes){if (exst.Equals(".doc")) openword( dest, "yes");}} else if (reply==DialogResult.No) {if (exst.Equals(".doc")) openword ( dest, "no");}   when I run this code...

Confirmation message for delete link button conflict with edit's cancel link button
Hello, I have used the tutorial of ASP.net's confirmation message for the delete link button of the gridview, but it conflict with the edit's cancel link button. Would somebody teach me how to fix it? Thanks. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs  e)    {               if (e.Row.RowType == DataControlRowType.DataRow)        {             // reference the Delete LinkButton&...

client-side message box...
I looked into putting a messagebox that alerts you whether or not you really want to delete it. I just put a simplistic button with the code in the subpage like it called for in the example, just a simple button click test and I am getting the error: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'BtnDelete' is not a member of 'ASP.test_aspx'.Source Error: Line 9: Private Sub ...

How to display message box at client side?
hi there, Can any body help me out to display a message box in asp.net. If so pls send me how to do it. It may be easy but I want to know how . thanks Regards, DeadRocker I use this function: public void ClientMessageBox( string message ) { Page.RegisterStartupScript( "alert", "<script>alert('" + message + "');</script>" ); } Niall...

displaying client side message box
i want to dispaly the system.Windows.Forms.MessageBox in the client side computer.. i try this code but when i excute it, i is displaying in server not in the client computer how am i going to do this. thanks in advance What kind of application are we talking about? Where is the code located? BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). like this im using asp.net i want to execute asp.net function. ex. public sub save() ...

Message Box to client for a confirmation- Is there a way?
I have a situation where my user selects a line from a Gridview control and populates a lower section of the page with data from that line.  There they can make changes to the data and apply those changes by pressing a button.  I need a way to display a confirmation request if the user selects another line from the Gridview control before pushing that apply changes button. This confirmation would say "Do you want to discard changes? (yes or no)".  When they select another line in the Gridview, I need to put code in the selectedIndexChanged event to first see if any editible fi...

message box with OK and CANCEL buttons
How to dreate a Message box with OK and Cancel button. And how to verify which button is pressed How to add text boxess inside Message box.   thanks and regard sankar    I had the same problem myself. It became obvious to me that client side pop-ups, alerts etc... weren't gonna do the job.  So I used this:http://www.codeproject.com/aspnet/Web_Message_Box.aspvery easy to use and does the job!!  if a plain javascript alert is what you need, then it is simply:var res = confirm("Are you sure?");res is true if user cliked OK and false if they click...

Adding Server Side Confirmation Message Box
Hi I have an application that allows the user to upload files as follows:   Browse is an Input of type file and upload file is an input of type submit. Everything is working fine, but I want to add a confirmation msg box (server side) if the file user trying to upload is exist display to confirm replacing it otherwise it will upload the file automatically without displaying the message.  How to add this msg to my code?  you need to use RegisterClientScriptBlockRefer below linkshttp://www.codeproject.com/KB/aspnet/Mayank_Gupta.aspxhttp://www.aspcode.net/SystemWebUIPag...

Confirm message box in javascript on a button click
Hi All, I have to display a confirm box when a button is clicked but only when a condition is met in Button1_Click event. (not always when a button is clicked) Page_load(.....) has this.Button1.Attributes.Add("onClick", "return MsgBox();"); Button1_Click(object sender, System.EventArgs e) { int x = 1;(Just for testing) if(x == 1) { Client Side JavaScript Confirm Box Code (Which Returns true on clicking OK and which returns false on clicking Cancel. True and false is returned to asp.net using a Htmlhidden...

Cancel response from confirm message box is not working.
Hello, I have this ScriptManager class below for the confirm message box along with the function calls from the server side for the "Ok" response.  If the response is Ok from the confirm message box, it will goes on in the code and call one of the function from the server side "PerformSearch()" and if the response is Cancel, don't do anything and close out the confirm message box.  When I click the "Cancel" button on the confirm box, it still goes on and perform a function from the server side  just like the "Ok" respons...

Confirm Message Box with OK or Cancel option in C#
Hi  All, I have a function call which  results in two conditions(True and False).When the condition is false,I wanted the code to display a message box with the two options (OK and Cancel) and when the user clicks the OK button It should direct to another page. Please anyone help me with the code ( in C# ) to display a confirm message box with this two options.Its urgent. Thanks for your help.     private void button3_Click(object sender, System.EventArgs e) { if (MessageBox.Show("Really delete?","Confirm delete", MessageBoxButto...

Problem dealing with the confirm message box in C#.net
Hi..i am actually trying to do something like this.When a user select a particular option from a dropdown list and click a 'Go' button, a confirm message box will be displayed if the user has selected that particular option.Other options selected will not display that confirm box when the 'Go' button is clicked.Once the user press the ok button on the confirm box,it will proceed to perform other tasks.How do i do that?..I try using the following code but it doesnt really work..the confirm box will always popup everytime the 'Go' button is clicked except for the first time u clicked on it. ...

Web resources about - Confirmation Message Box with Replace and Cancel buttons - asp.net.client-side

Confirmation - Wikipedia, the free encyclopedia
A bishop administering Confirmation. Rogier van der Weyden , The Seven Sacraments , 15th century. normally carried out through anointing , the ...

Confirmation - Wikipedia, the free encyclopedia
A bishop administering Confirmation. Rogier van der Weyden , The Seven Sacraments , 15th century. normally carried out through anointing , the ...

Facebook Reportedly Acquires Gowalla, No Confirmation From Either Company
... “most” of its employees and founder Josh Williams over to Palo Alto headquarters to work on Timeline, according to CNN. We could not get confirmation ...

Twitter reactions to the #Fed confirmation
... over Twitter — the last time that a new chairperson was appointed, Twitter wasn’t around. Within half an hour of the milestone confirmation, ...

Senate Confirmation Hearing (200910150008HQ) - Flickr - Photo Sharing!
U.S. Sen. Jay Rockefeller, D-W.Va., Chairman of the of the Senate Committee on Commerce, Science and Transportation, makes a point during the ...

Wet Hot American Summer: First Day of Camp - Cast Confirmation - Netflix - HD - YouTube
The counselors are confirmed for Wet Hot American Summer: First Day of Camp, a limited 8-episode series coming to Netflix just in time for summer. ...

Barry O'Sullivan's Senate confirmation delayed
Queensland will be without one of its senators until at least February next year.

Is this confirmation Prince George and Princess Charlotte's nanny is Mary Poppins?
The christening of Princess Charlotte was touted as &quot;modern&quot;. No one told the nanny.

Jurgen Klopp Liverpool, Jurgen Klopp news, Jurgen Klopp Liverpool confirmation
JURGEN Klopp is officially the new Liverpool manager.

Is this confirmation Prince George and Princess Charlotte's nanny is Mary ...
Sydney Morning Herald Is this confirmation Prince George and Princess Charlotte's nanny is Mary ... Sydney Morning Herald There were many ...

Resources last updated: 12/28/2015 8:02:42 PM