Decrease Font Size
Increase Font Size

ASP-NET Confirm dialog box based on DropDownList selected value

by bryian 15. February 2010 13:30

ASP.NET Confirm dialog box based DropDownList selected value

ASP.NET JavaScript popup window basedon DropDownList selected value

Popup confirmation before ASP.NET Form Submit |

Add a JavaScript popup to an ASP.NET button |

Display Confirmation pop up window |

ASP.NET DropDownList Confirmation |

ASP.NET Adding JavaScript confirm to button based on DropDownList selected value |

Show JavaScript confirm message if DropDownList selected value equal



User want to see a popup confirmation dialog box on LinkButton click, only if the DropDownList.SelectedValue == ?

See example below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <asp:DropDownList runat="server" ID="ddlTest">
        <asp:ListItem Selected="True">select</asp:ListItem>
    <asp:LinkButton ID="IsertButton"
                  Text="Insert" onclick="IsertButton_Click"
                  OnClientClick="return CheckIfZeroSelected();" />
  <script type="text/javascript">
      function Insert_Confirmation() {
          if (confirm("Are you certain that you want to insert with selected value 0?"))
              return true; else return false;

      function CheckIfZeroSelected() {
          var selObj = document.getElementById('<%= ddlTest.ClientID %>');

          if (selObj.selectedIndex === 0) {
              return Insert_Confirmation();

Tags: , ,


Comments (12) -

1/19/2010 11:54:53 AM #

Catering Sydney

Good post...this is by far the best code I've seen on this topic on the internet.I really like to personally thank you and I look forward to reading your blog more and more..I love to visit her very often.....

Catering Sydney India

1/30/2010 6:26:44 PM #

ripped abs

I hope your blog and articles will keep on putting me on the right direction as long as possible! Thanks ---

ripped abs Turkey

1/30/2010 8:43:05 PM #


Great code. many thanks.

leslie United States

2/1/2010 9:46:47 PM #

cheap hotels in las vegas

Hai friends, I want to display a confirm messagbox with "ok" and "cancel" button. when i click ok it has to call a procedure to do deletion.

cheap hotels in las vegas United States

2/2/2010 12:40:08 PM #



df United States

2/7/2010 5:17:41 AM #

Acid Reflux Symptoms

I was very pleased to find this site. Thanks for this great read!  I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

Acid Reflux Symptoms Caribbean

2/14/2010 1:46:24 PM #

Abogado Laborista

Hi from Russia! Will it be possible for me to quote a post as part of your weblog with the link to you? I've tried emailing you regarding this problem but it appears i cant achieve you, please reply when have a moment, thanks.

Abogado Laborista France

2/15/2010 2:53:23 AM #

laser pointer

nice post.

laser pointer United States

2/25/2010 12:35:52 PM #

indonesia java international destination

you put the all great things which makes all people getting interested. but yes thats right, i agree. all you mention is make a sense. thanks

indonesia java international destination United States

3/8/2010 7:11:39 AM #

mobile banking software

This is really such an interesting and very knowledgeable post here you have submitted so that i think i like it very much. I think it can be very beneficial for most of the people.

mobile banking software United States

3/16/2010 1:36:29 AM #


I've been trying to find a good forum on dropdownlist confirmation and related material. Thanks for putting this up.
Take care

William Bolivia

4/27/2010 5:33:14 AM #

Lorrie Guion

great code helped me a lot since i am just beginning....
i will be following up on your blog soon!

Lorrie Guion United States

Add comment

  Country flag

  • Comment
  • Preview