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
0
Michiganlaker
9/3/2003 7:58:57 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

1 Replies
1330 Views

Similar Articles

[PageSpeed] 21

can't be done. sorry.
0
Andy
9/3/2003 8:37:48 PM
Reply:

Similar Artilces:

Confirmation Box with "Yes" and "No" Button
Hi I am using Confirmation Box in my application Instead of "ok" and "cancel" I want to display "Yes" and "No" in Confirmation Box Buttons Is there any way to do it Please help me out  I dont tkink it is possible to customize confirmation baox like that.Vikram www.vikramlakhotia.comPlease mark the answer if it helped you One option is to build your own HTML page with these two buttons and show it modally (showModalDialog) and get the results.Mark replies as answers if they helped you solve the problem. Hi, Take a look over here: h...

Wizard Control: Set focus to "next" button before "previous" button
Hello all, I have now run into another wizard quirk that I'd like to change. Right now, apperantly by default, the wizard control tabs to the "Previous" button before going to the "Next" button. Also, if I am in a textbox on my form, pressing the Enter key will trigger the previous button on the wiz control. Is there a way to have this switched, so that the next button is the first button on tab and also the default button for the Enter key?  Thanks! hi Slachkey, here is a useful thread http://p2p.wrox.com/topic.asp?TOPIC_ID=46256 How Do I Set the DefaultFocus or DefaultButton in a Page Based on a Master Page in ASP.NET 2.0? You may be aware of the new DefaultButton and DefaultFocus properties that a few ASP.NET 2.0 controls, including the HtmlForm have. These properties allow you to determine which button gets "clicked" when you hit enter on the page, and which form control gets the focus when the page loads. (If you're not familiar with them, check out this MSDN help file (1)) But how do you use this feature in a page based on a Master Page? Your first attempt may be to add the following code in the Page_Load event of the Content page: Page.Form.DefaultFocus = "TextBox1" Page.Form.DefaultButton = "Button1" However, as soon as you run this code, you'll get the following error: Server Error in '/MyApplication' Application.   The DefaultButton of 'form1' must be the ID of a control of type IButtonControl. Description: An unhandled ex...

confirmation message box "Yes" or "No" in the code behind?
Hello, I want to implement the comfirmation message box with 2 control buttons "Yes" or "No" in the code behind. How do I do it? If a user clicks "Yes" on the confirmation box, I want to display something to a user and if a user clicks "No", another confirmation message box pop up for additional choices. How do I get 2 control buttons on the confirmation message box work if either one is clicked.  Thanks       I don't quite know what you mean when you say you want it in the code behind. There's no way to implement som...

superreview cancelled: [Bug 199262] Swap "Mark" and "Junk" Buttons (so that "Next" and "Mark" buttons are next to each other) : [Attachment 118601] patch that swaps the "Mark" and "Junk" buttons
Adam Becevello <bugs@abecevello.imapmail.org> has cancelled Adam Becevello <bugs@abecevello.imapmail.org>'s request for superreview: Bug 199262: Swap "Mark" and "Junk" Buttons (so that "Next" and "Mark" buttons are next to each other) https://bugzilla.mozilla.org/show_bug.cgi?id=199262 Attachment 118601: patch that swaps the "Mark" and "Junk" buttons https://bugzilla.mozilla.org/attachment.cgi?id=118601&action=edit ------- Additional Comments from Adam Becevello <bugs@abecevello.imapmail.org> Remo...

Programmatically Populating the "mail.settings" section of "system.net" in web.config
I am fully aware that the system.net section of web.config typically looks something like this:  <system.net>    <mailSettings>      <smtp from="noreply@sample.com">        <network host="smtp_server_address" userName="myUsername" password="myPassword" />      </smtp>    </mailSettings>  </system.net>If web.config is so populated then this info is used for sending e-mails generally and al...

"send" and "cancel" buttons are cut off
Hello, When I access certain web pages, the "send" or "cancel" or similar buttons are cut off at the bottom of the particular window. I can get to see them by going to "view\zoom\zoom in". But is there any way to save these settings? "Reset" does not do it nor does not hitting "reset". If I leave the zoom settings where they show the buttons I need to see, it only lasts as long as I am in that FF session. When I close or re-open Firefox, the window still has cut off the buttons. Thanks for any advice. Jack On 01/23/2010 06:3...

"Yes"/"No" Message Box Untied to a Control
I need to be able to prompt the user of an ASP.NET page for a “Yes” or “No” answer depending on levels of certain variables. This requires a message box, similar to a JavaScript client side confirm message, but not tied to any control. Further processing on the page is to depend on the answer returned. I have not been able to find any way to do this. Help would be most appreciated. -wire up your prompt to a button click or something btn.attributes("onclick")= "javascript:myFunction()" -in your javascript function I would set the value from your prompt to a hidde...

dropdownlist in value "A" then pop up "Confirm Box"
hi, i was in trouble in C# web form programming. i got a dropdownlist, value was "A", "B", "C", "D". and i need to make a confirm box when dropdownlist value equals "A". How do i write it? please , i really can't find out the answer. thank you!Moon with Ice... you would write something like this: On the server: dropList.attributes.add("OnChange","findA();") ' findA being the name of your javascript function On Client: findA(){    var ddl = document.getElementById('dropList');    if (ddl.value == 'A'){       confirm('ar...

"Default" Button for a Web Form
It seems that on some Web forms we create, you can enter data into the fields and then press enter and the "submit" button works. On other forms, this does not work. We cannot seem to find any pattern on why this happens. Is there a way to make a button on a Web form the "default" button when the user presses the Enter Key? And on the same note, what about the "Esc" key for cancel? Thank you, Jude Naes this question has been answered a couple of times..you cansearch on these forums for "Defualt button + asp.net" or google and am sure you wo...

how to have a "yes", "no", "cancel" in javascript with c#?
 how to use a "yes", "no", "cancel" message box to allow user select. Javascript you have only Yes and Cancel see belowfunction callAlert() {if (confirm('Are you sure you want to Delete?')) {alert("Yes"); } else {alert("No"); } }   To Get Yes No Cancel you will have to use VBScript <script language="VBscript"> ' Buttons Yes, No, and CancelDim box box = MsgBox ("Are You Sure?", 35, "Dialog Title") </script>  MAKMark as Answer if this reply helps youMVP A...

Get "Mail"/"Get "News" / "Write"/"Post" buttons?
If the "Get Mail" button text changed to "Get News", and "Write" changed to "Post" when TB's in the news-reading mode, it would save me and probably others from constantly forgetting to make the change before proceeding. :-) Or is there an extension to do this which I don't know about? Thanks! Bob Bob P wrote: > If the "Get Mail" button text changed to "Get News", and "Write" > changed to "Post" when TB's in the news-reading mode, it would save me > and probably others...

Me.placeholder1.Page.Request.Form.Set("textbox", "test")
hi,   i need to pass some value from the masterpage to a control in the contentplaceholder, i have tryed this and i think thats the way to do it but i get an error: read-only   my code:   Me.placeholder1.Page.Request.Form.Set("textbox", "test")-ande--rap-***.net--ande.somee.com-- Request.Form is a collection of the values that were POST:ed to the page, and it's read only, since it's too late to change what was posted.Dim textbox as TextBox=TryCast(Me.placeholder1.FindControl("textbox"),TextBox)If Not textbox is Nothing Then &...

Encrypting "connection strings" and "mail settings" in web.config
I'm trying to encrypt two sections of my web.config.  Encryption works fine when I try encrypting either <connectionStrings> or <system.net/mailSettings/smtp> alone.  But when I try and do both together, I get an error and only the <connectionStrings> section encrypts properly.  Here's the error:Parser Error Message: The configuration file has been changed by another program.Source Error: [No relevant source lines] Here's the code I'm using . . .protected void EncryptConfig(bool bEncrypt) {obje...

How To Set "Trial Application" and "Bound To This Machine" .NET application only
Hi, This is the first time I made a web application for a client. Since he has not paid me, what should I do so that the application will terminate within x days starting from the day I install the application in his server ? And is it possible to make application works on his server only ? I don't want the files copied without my permission.   Thank you very much for your attention.  ===================================Don't Quote And Flame Me If I Am Wrong===================================...

[Suggestion] Add a "Restart " button in "Add-ons" form
Name: Claudio Email: togixatliberodotit Product: Firefox Summary: [Suggestion] Add a "Restart " button in "Add-ons" form Comments: Hi, my name is Claudio and I’m here because I’ve noticed one thing during all this time that I use Firefox (nowadays it’s about two years): when a new Add-on is installed and activate, or a new Theme is selected, a string appears and suggest to restart the browser in order to use it. But sometimes there are many tabs opened and we have to delay the reload and see the effects of the changes. So what I think that could be u...

Confirm delete how to know that if "Okay" was pressed or "Cancel" was pressed
Confirm delete how to know that if "Okay" was pressed or "Cancel" was pressed when deleting items from the datagrid control. HighOnCodingWanna get high! Solved that problem now how can I get the ID from the column 0. I am trying something like this in the item created event of the Datagrid. e.Item.Cells[0].Text; but this is always ""   HighOnCodingWanna get high! If I get your problem correctly, you could use e.Item.Cells[0].Controls[0].ID Thanks/007My ASP.NET blog ~God doesn't play dice... ACtually not the id of the first column but the value of the first...

Is "Session" the best solution for transfering variables between "Web Forms"??
Hi all; I am using an ASP.NET Web Application (with VB.NET)... and this App used to manage customers' requests.. so, ther user will handel customer#1 data for a while, then he (the user) will handle the data of customer#2. and so on.. And I need to transfer some variables value from one page (Web Form) to onother pages (Web Forms), Is the "Session" variable the BEST solution? and do you recommend me to increase its live to 60 mins or more. (In case the user need approx. 1 hour to handle customer#1 data!!)?? Example of values I want to transfer: CustomerID, RequestNo, Co...

Suggestion: Add a button "Sort" in the window "Message filters".
Name: Maarten Email: mgroosmanatcaiwaydotnl Product: Thunderbird Summary: Suggestion: Add a button "Sort" in the window "Message filters". Comments: The filters I created in "Options-Message filters" appear not alfabetical. An alfabetical order would spare a lot of time not having to set them in that order by hand by moving them separately up or down. Suggestion: Add a button "Sort" in the window "Message filters". Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13...

Set focus in panel on Style.Item("display") = "block"
Hi,               I am having a Panel in Formview. Now i am displaying panel using panel.Style.Add("display", "block") on click of a link button in same formview. I am having a TextBox within that Panel and i want to setFocus in that TextBox when panel is displayed. I tried  TextBox.Focus() on LinkButton click but its not working. Also tried to set focus in PreRender of Panel still not working. Please provide me some idea on my issue. The best way is to write a javascript to focusCheers,Emad Yazdanpanah From http://www.CSharpCourses.com Hi,          Thanks for reply.          I am having senario where i am supposed to use panel and show / hide it on server side.  I did javascript code on Link Button click but as panel is not visible by default. So on click i will not get TextBox in javascript as it is in panel which is not displayed using server side code.  Can you give me some idea on which event in javascript should i set focus. hi there, I think the best way is that the same place you are adding the panel code add this code as well panel1.attributes.add("onload","javafunc()");Cheers,Emad Yazdanpanah From http://www.CSharpCourses.com Hi,                  Fi...

"textbox_textchanged" to set focus onto button
Hi, I have one textbox and one button. The intention is that whenever user typed something into the textbox, the focus will be set onto the button. So that user will just need to hit "ENTER" to execute. No need mouse click anymore. I wrote this but it failed me: 1 Protected void textbox_TextChanged(object sender, EventArgs e) 2 { 3 this.button.focus(); 4 }Appreciate your help.Cheers....  That approach is very bad, because you will have a round trip to the server just to set the focus on the button. And to even get it to work, user has t...

Message "pending" and "transfer delayed" messages
My users are receiving message pending and trasfer delayed messages on about 10 out of 1000 messages. On the GWIA we are geting DMN send failed 421.1.1 the firewall couldn't contact "domain" I have traced the SMTP e-mail from the GWIA to the firewall and can see the SMTP message go out via the logs. Any ideas? Dan Hi Dan.... Wow...the brewers use GroupWise :)........I'm right down the road from ya at MATC. Anyway....are the delayed messages typically to the same domain? If so, try doing an NSLOOKUP and check out the domain itself and the...

superreview cancelled: [Bug 253944] enablePrivilege dialog uses "Yes" and "No" as button labels : [Attachment 156223] use OK/Cancel
Steffen Wilberg <steffen.wilberg@web.de> has cancelled Steffen Wilberg <steffen.wilberg@web.de>'s request for superreview: Bug 253944: enablePrivilege dialog uses "Yes" and "No" as button labels http://bugzilla.mozilla.org/show_bug.cgi?id=253944 Attachment 156223: use OK/Cancel http://bugzilla.mozilla.org/attachment.cgi?id=156223&action=edit ...

Divide a "Preview" button and an "Next" button.
Name: Ichoro Yamazaki Email: presidentatcommentsdotsakuradotnedotjp Product: Firefox Summary: Divide a "Preview" button and an "Next" button. Comments: Divide a "Preview" button and an "Next" button. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

"0E0 messages" vs "0 messages"
I just noticed one of the inormational messages in tkmail changed from "0 messages ..." to "0E0 messages" when running under 5.005_62+ - it is no big deal but looks odd. What has happened to stringifying things in _62 ? The modules and such should be the same as I was using in _60+ -- Nick Ing-Simmons On Tue, 19 Oct 1999 20:29:25 BST, Nick Ing-Simmons wrote: >I just noticed one of the inormational messages in tkmail >changed from "0 messages ..." to "0E0 messages" >when running under 5.005_62+ - it is no big deal but >...

Web resources about - How to set focus to "Cancel" button in the confirm message box? - asp.net.web-forms

Resources last updated: 2/23/2016 9:10:05 AM