• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • Last Modified:

Conditionally display Confirm Button

I am going to hook up a Submit button on one of my pages to the ConfirmButtonExtender.  This is fairly straightforward - however, I want to only display this Confirm Button if a certain value is selected in a DropDownList, otherwise I just want the submit to happen with no message.  Any ideas?
0
RAFUser
Asked:
RAFUser
  • 2
  • 2
1 Solution
 
sm394Commented:
something like that

<asp:DropDownList ID="DropDownList1" AutoPostBack="true" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
                <asp:ListItem Text="Enabled">
                </asp:ListItem>
                <asp:ListItem Text="Disabled">
                </asp:ListItem>
            </asp:DropDownList>
            <asp:Button ID="btnSubmit" Visible="false" runat="server" Text="submit" />


===code behind
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (DropDownList1.SelectedValue.Equals("Enabled"))
            {
                btnSubmit.Visible = true;
            }
            else
            {
                btnSubmit.Visible = false;
            }
        }
    }
0
 
RAFUserAuthor Commented:
Sorry, I think I mistyped what I want.

I want to only show the confirm message if a particular item in my DropDownList is selected.
0
 
prairiedogCommented:
You can put the droptdownlist, button, and the confirmbuttonextender in a UdpatePanel, then set ddl's autopost=True, then in the code-behind, the ddl's SelectedIndexChanged event handler, if the selectedValue is the value that requires no confirmation, then just set confirmbuttonextender.enabled = false, otherwise set it to Ture.
0
 
RAFUserAuthor Commented:
Prairie,
I am a beginner with AJAX in general, and haven't worked with an UpdatePanel before.  I will try your suggestion.
0
 
prairiedogCommented:
Just let me know if you have trouble with it and need some examples.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now