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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:24:05+00:00 2026-05-12T14:24:05+00:00

I have an ascx control which contains dropdownboxes I want to be able to

  • 0

I have an ascx control which contains dropdownboxes I want to be able to reset with JavaScript.
Because the ascx control is rendered multiple times on the aspx page, I programatically add a distinguishing field to each dropdown such as this in the code behind of the ascx:

var g = Guid.NewGuid().ToString().Replace("-", "");
DropDownListBool.Attributes.Add("jqID", "ddBool" + g);
DropDownListEqual.Attributes.Add("jqID", "ddEq" + g);

On the rendered page, when I want to reset the dropdowns for one of the controls, I have a hyperlink which invokes a javascript function with g as an argument.

In the javascript, using jquery, I try to get both dropdowns for one specific ascx control like this:

function clearControl(g) {
var dds = $("select[jqID = 'dd\\S*" + g + "']");
}

I then do:

jQuery.each(dds, function(i, val) { val.select = 0; });

Should this work? Right now it is resetting seemingly random dropdown boxes.
Is there perhaps a limit to attribute length?

  • 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-12T14:24:05+00:00Added an answer on May 12, 2026 at 2:24 pm

    I think you might have better luck with a different selector, say the “ends with” attribute selector.

    var dds = $("select[jqID$='" + g + "']");
    

    If you needed to select based on starting with dd and ending with the value of g, you could use a filter and utilize both “ends with” and “starts with“;

    var dds = $("select[jqID^='dd']").filter( "[jqID$='" + g + '']");
    

    As far as I know you can’t use a regular expression when using the attribute equals selector. I’m surprised it works for you at all.

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

Sidebar

Related Questions

If I have a custom user control (say, MyCustomControl.ascx) which contains a number of
In a particular page i have a ascx control which contains a table. Now
I have a custom user control (ascx) that contains a textbox and a Javascript-based
I have made a basic ascx control which is just a panel with a
I have an asp:FormView on a control (in an ascx file) which is loaded
I have an ASP.NET user control (.ascx file). In this user control I want
my structure is like this: master page aspx(web form) ascx(user control) I have a
I have created a web user control (MemberDetails.ascx) which is loaded dynamically on a
I have LogOn.ascx control which is located on master page site.master: <% Html.RenderPartial(LogOn); %>
I have a simple user control that contains some buttons that fire events which

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.