Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6108171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:16:04+00:00 2026-05-23T14:16:04+00:00

I said in my last question and will say in this one too, basically

  • 0

I said in my last question and will say in this one too, basically my username reflects my experience!

I currently have a page with 2 listviews, one of which has a number of controls in the InsertItem template.

One of these controls in particuilar is a DDL and I have a Modal Popup Extender hooked up to it. I want to trigger the MPE only when a particular value(not index) is selected. Here is where I am up to now!

DropDownList ExpenseTypeDDL = 
    (DropDownList) Expenses.InsertItem.FindControl("ExpenseTypeDDL");
int ExpenseType = (Int32.Parse(ExpenseTypeDDL.SelectedValue.ToString()));

if (ExpenseType == 1)
{
    AjaxControlToolkit.ModalPopupExtender mpeMiles = 
        (AjaxControlToolkit.ModalPopupExtender)Expenses.InsertItem.
        FindControl("mpeMiles");
    mpeMiles.Show();
}

Above are the contents of the DDL SelectedIndexChanged event. This DDL is based on expense types, I want to target a particular value (db primary key) and then display the modal popup so the user can enter their mileage then do some other stuff after.

Here is my mpe

<cc1:ModalPopupExtender ID ="mpeMiles" TargetControlID ="ExpenseTypeDDL" 
    runat="server" DropShadow="true" PopupControlID="pnlMiles" 
    BackgroundCssClass="modalBackground" />
<asp:Panel CssClass="modalPopup" ID="pnlMiles" runat="server" 
    Height="170px">
    <div style="padding: 5px; text-align:center">
        <asp:Label ID="lblStart" runat="server">Start location.</asp:Label>
        <asp:TextBox ID="txtLocationStart" runat="server" />
        <asp:RequiredFieldValidator ID="reqLocation" runat="server" 
            ErrorMessage="You must enter a start location" 
            ControlToValidate="txtLocationStart" Display="Dynamic" Text="*" >
        </asp:RequiredFieldValidator>
        <asp:Label ID="lblDestination" runat="server">Destination.</asp:Label>
        <asp:TextBox ID="txtDestination" runat="server" />
        <asp:RequiredFieldValidator ID="reqDestination" runat="server" 
            ErrorMessage="You must enter a destination" 
            ControlToValidate="txtDestination" Display="Dynamic" Text="*" >
        </asp:RequiredFieldValidator>
        <asp:Label ID="lblMiles" runat="server">Please enter your Mileage</asp:Label>
        <asp:RequiredFieldValidator ID="reqMileage" runat="server" 
            ErrorMessage="You must enter your mileage" ControlToValidate="txtMiles" 
            Display="Dynamic" Text="*" ></asp:RequiredFieldValidator>
        <asp:TextBox ID="txtMiles" runat="server" />
        <br />
        <br />
        <asp:Button ID="btnMiles_OK" runat="server" Text="Save" 
            CausesValidation="false" />
        <asp:Button ID="btnMiles_Cancel" runat="server" Text="Cancel" 
            CausesValidation="false"/>
    </div>
</asp:Panel>

At the moment the mpe shows as soon as the DDL is clicked, but I want that to happen only for the selected value of 1.

Can someone please tell me what I am doing wrong?

TIA

dotnetnewb

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:16:05+00:00Added an answer on May 23, 2026 at 2:16 pm

    This is happening because you have set up the DDL as target of your modal popup extender – so whenever target index is changed, the dialog is shown. The solution is to have an hidden button and make that a target control for modal popup extender – if your DDL has auto-postback as true then your server side code will check the selected index and popup the dialog.

    From user experience perspective, unless you have UpdatePanel on page, this would mean on DDL change, page will refreshed and a dialog will be shown. You can also use modal pop-up javascript API to show/hide on DDL selected index change w/o doing post-back. For example,

    $find('mpeMiles').show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: The below question was answered by this . I have a new updated
Ive made mis-leading topic in my last question, so i open this new question
The question seems settled, beaten to death even. Smart people have said smart things
One of my former students sent me a message about this interview question he
As said in the title, I have a scrollview that should be listening for
They said this expression is valid in C, and that it means calling a
I've recently started tinkering with ASP.NET MVC, but this question should apply to classic
First of all, I am sorry if this question doesn't belong to SO since
My teacher gave me this question: Write a program that does the following: Enter
Inspired by this question. Why is there no list.clear() method in python? I've found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.