By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Alert with "yes" and "now" as button text

P: 8
Thank you very much , it worked! :)

can you tell me If it is posible to change the 'ok' and 'cancel' to 'yes' and 'no' ???
Aug 8 '12 #1
Share this Question
Share on Google+
11 Replies


ariful alam
100+
P: 185
@kamiii, what are you really want? can you Xplain please.
Aug 8 '12 #2

P: 8
@ariful : thank you for your attention

I want to change the ok buttun to yes or sth else
I want to know is it possible or not?
Aug 8 '12 #3

ariful alam
100+
P: 185
@kamiii, would you please text an example here what you are actually need to do.
Aug 8 '12 #4

P: 8
look , I wanted to have a diolog box in order to check that if you are sure to delete an item or not.
and by this code I could do that :

Expand|Select|Wrap|Line Numbers
  1. <asp:ImageButton ID="btnDelete" runat="server" OnClick="btnDelete_Click" ImageUrl="~/Images/icon/deletebuttonoff.png"
  2. CausesValidation="False" OnClientClick="return confirm('are u sure ?')" />

it gives me a diolog box which I should click 'ok' or 'cancel'

now I want to change this 'ok' to 'yes' , and 'cancel' to 'no'
Aug 8 '12 #5

Frinavale
Expert Mod 5K+
P: 9,731
Please post new questions in their own threads. I split this question off of the thread Server Tag Not Well Formed and moved it into the JavaScript forum where it is more likely that the experts know how to achieve what you are looking for.

-Frinny
Aug 8 '12 #6

ariful alam
100+
P: 185
@kamiii, i don't think so. It may be not possible to change the Ok and Cancel button of Confirm Dialog to Yes and No button. You can create your own custom message box using buttons Yes and No in a div tag that may return a value true (for Yes) or false (for No).
Aug 8 '12 #7

P: 8
@Frinavale : I didn't get it where should I search for yhis question exactly?!
Aug 8 '12 #8

P: 8
@ariful alam: but how?! I haven't any idea at all! :(
would you please tell me what should I do more specifically ?
Aug 8 '12 #9

Frinavale
Expert Mod 5K+
P: 9,731
What @ariful alam is suggesting is suggesting is getting rid of using the JavaScript alert/comfirm completely.

Instead you would have a <div> that would display your message and have 2 buttons "yes" and "no".

So, really your ImageButton would not submit anything to the server at all. When the user clicks the ImageButton, it would display the <div> that contains the message and the "yes" and "no" button.

The Yes button would be the thing that submit to the server...the No button would simply hide the <div>.

Something like this:
Expand|Select|Wrap|Line Numbers
  1. <div id="confirmSubmit" style="display:none; position:absolute; z-index:1; height:200px; width:200px;">
  2.   <div id="messageSection">
  3.     <p>Are you sure?</p>
  4.   </div>
  5.   <div id="buttonSection">
  6.     <asp:Button ID="userConfirmed" OnClick="btnDelete_Click" runat="server" Text="Yes" onclick="document.getElementByID('confirmSubmit').style.display='none'" />
  7.     <input type="button" onclick="document.getElementByID('confirmSubmit').style.display='none'">No</input>
  8.   </div>
  9. </div>
  10.  
Your ImageButton would execute some JavaScript to display the above <div>:
Expand|Select|Wrap|Line Numbers
  1. <asp:ImageButton ID="btnDelete" runat="server"  ImageUrl="~/Images/icon/deletebuttonoff.png"
  2. CausesValidation="False" OnClientClick="document.getElementByID('confirmSubmit').style.display='block'; return false;" />
Make sure that the function signature for the btnDelete_Click method works for the Yes button.

If you don't want to use html <div> and want to stick to ASP.NET controls, you can use Panels like this:

Expand|Select|Wrap|Line Numbers
  1. <asp:Panel ID="confirmSubmit" runat="server" style="display:none; position:absolute; z-index:1; height:200px; width:200px;">
  2.   <asp:Panel ID="messageSection" runat="server">
  3.     <p>Are you sure?</p>
  4.   </asp:Panel>
  5.   <asp:Panel ID="buttonSection" runat="server">
  6.     <asp:Button ID="userConfirmed" OnClick="btnDelete_Click" runat="server" Text="Yes" onclick="document.getElementByID('confirmSubmit').style.display='none'" />
  7.     <asp:Button ID="userCanceled" runat="server" onClientClick="document.getElementByID('confirmSubmit').style.display='none'; return false;" Text="No" />
  8.   </asp:Panel>
  9. </asp:Panel>
  10.  

You can get quite fancy with this. You could display a <div> over top of the content of the page while your message box is displaying to prevent people from interacting with the page. You can style the div to match the look and feel of your website...You can use asp.net Labels and localize your message to fit the language of the user...you could add images or whatever you want to your message...You can do quite a bit with it!



-Frinny
Aug 8 '12 #10

Frinavale
Expert Mod 5K+
P: 9,731
As to where to post questions...

If you have a question that is JavaScript related, ask it in the JavaScript forum where the experts have knowledge about the topic.

If you have an ASP.NET related question, ask it in the ASP.NET forum, where the experts have the knowledge about the topic.

Because ASP.NET is web related, your questions may span across both places...in which case, try to figure out which forum the experts might have more knowledge about the problem and post there :)

And try to limit yourself to 1 question per thread :)

-Frinny
Aug 8 '12 #11

P: 8
@Frinavale:

thank you very much Frinny :)
you spent so much time on my questions! thanks alotttt .....

and , ok , sure, I will do what you said about my later questions :)
Aug 11 '12 #12

Post your reply

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