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 8679439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:58:23+00:00 2026-06-12T20:58:23+00:00

I have a dropdownlist that I want to wrap in a span. What I

  • 0

I have a dropdownlist that I want to wrap in a span.
What I would like to happen is…

When a user selects a new item from the dropdownlist, the span will check a js function and accept a return value of true/false.

If the span value = true then let the user continue with the selection, otherwise cancel selection and return the dropdownlist selected value to -1.

I have looked at many examples for the span tag but haven’t been able to find something that will return a value.

How can I get this to work?

Thanks

 <span ????>
 <asp:DropDownList ID="ddSelectFormula" runat="server" 
           AppendDataBoundItems="true" AutoPostBack="false" CssClass="controltext" 
           DataSourceID="lnqSelectFormula" DataTextField="FormulaName" 
           DataValueField="FormulaID">
           <asp:ListItem Selected="True" Text="Select Formula" Value="-1">   </asp:ListItem>
        </asp:DropDownList>
 </span>

 function checkFormulaID() {
    var hi = document.getElementById("ctl00_ContentPlaceHolder1_HiFormulaIDList").value;
    var dd = document.getElementById("ctl00_ContentPlaceHolder1_ddSelectClientFormula").value;
    var ddVal = dd.options[dd.selectedIndex].value;
    if (hi > 0 && ddVal > 0) {
        var retVal = confirm("Do you want to replace the current formula with this one?");
        if (retVal == true) {
            return true;
        };
    } else {
        return false;
    }
}
  • 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-06-12T20:58:24+00:00Added an answer on June 12, 2026 at 8:58 pm

    Your dropdownlist just needs to include

        OnClientClick="checkFormulaID"
    

    You may also have to edit your JS for the comparison if (hi > 0 && ddVal > 0) since JS can do crazy things with the value propery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DropDownList that asks the user if he want to join the
I have dropdownlist,which get filled from table1.That table1 has Zero value.While filling the dropdown,want
I have a DropDownList that contains Station codes. @Html.DropDownList(Station, null, new { id =
i have a dropdownlist that populates from the sql server database. populating the list
I have an ASP.NET DropDownList control that retrieves the first and last name from
I have a dropdownlist inside a gridview, that is loaded from a datasource when
I have a DropDownList called (DDL) in ASP.net page, I want that DDL contains
I want to have a link that is like this change(en-NZ) which shows the
I have a dropdownlist in ASP.NET Webforms that I want to calculate how many
I have a dropdownlist that I want to populate with a specific value and

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.