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

  • Home
  • SEARCH
  • 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 8997081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:50:25+00:00 2026-06-15T23:50:25+00:00

I am new to Asp.net I am creating website which have DropDown list and

  • 0

I am new to Asp.net

I am creating website which have DropDown list and few other controls..

Whenever I change dropdown selected index, if it is equals to one of Item then I want to display controls if it is not equals then I want to hide those controls …

Here I tried with this code but not get…

  var selectmenu = document.getElementById("<%=ddlCategory.ClientID%>");
    var chosenoption = selectmenu.options[selectmenu.selectedIndex];
     //Controls which are to hidden or visible
    var strCtrlIds =   "lblOrderNumber,txtOrderNumber,btnGetOrderNumber,lblItemNumber,txtItemNumber,lblReason,txtReason,lblMaterial,txtDescription";
     if (chosenoption.value != "Dry End - Single Stack") {
         debugger;
         ToggleGivenControl(strCtrlIds, false);

     }
     else {
         ToggleGivenControl(strCtrlIds, true);
     }
     /**********************************************************
                    Toggle for Display End- Stack Options
     ************************************************************/


     function ToggleGivenControl(strCtrlIds, blnIsVisible) {
         debugger;
         var ctrls = strCtrlIds.toString().split(",");
         var strCtrlId = '';
         for (var intCnt = 0; intCnt < ctrls.length; intCnt++) {
             strCtrlId = ctrls[intCnt];
             var ctrl = document.getElementById(strCtrlId);
             if (ctrl != null) {
                 if (blnIsVisible) {
                     ctrl.style.display = 'block';
                     ctrl.style.visibility = 'visible';
                     ctrl.focus();
                 }
                 else {
                     ctrl.style.display = 'none';
                     ctrl.style.visibility = 'hidden';
                 } //Else End
             } //If End.
         } //For end.
     }

And My asp.net Code is

  <asp:DropDown id="ddlCategory" runat="server" />
  <asp:Lable id="lblItem" runat="server" />
  <asp:TextBox id="txtItem" runat="server"/>
 ....

And one thing is I bounded dropdown with datasource

please can any one clear my problem?

  • 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-15T23:50:26+00:00Added an answer on June 15, 2026 at 11:50 pm

    I think somthink like this.

    <asp:DropDown id="ddlCategory" runat="server" onchange="OnDropDownListChange();" />    
    function OnDropDownListChange(){
       var selectmenu = document.getElementById("<%=ddlCategory.ClientID%>");
      var chosenoption = selectmenu.options[selectmenu.selectedIndex];
     //Controls which are to hidden or visible
     var strCtrlIds =    "<%=lblOrderNumber.ClientID%>,<%=txtOrderNumber.ClientID%>,<%=btnGetOrderNumber.ClientID%>,<%=txtItemNumber.ClientID%>";
     if (chosenoption.value != "Dry End - Single Stack") {
         debugger;
         ToggleGivenControl(strCtrlIds, false);
    
     }
     else {
         ToggleGivenControl(strCtrlIds, true);
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to ASP.NET. I am creating a website in which i have
I have created a new ActionFilter for an ASP.NET MVC application that I'm creating.
I'm creating an ASP.net website which handles thousands of requests and it all stems
I'm building an ASP.Net website. I have a cart class which stores the items
I have an ASP.NET web site which contains some ImageButton controls that cause postbacks
I'm creating a new ASP.net website via Visual Studio. I then try to run
I am Creating a new ASP.Net website not mvc, and willing to make the
I am new to asp.net. I am creating a ASP.net website using VB.net. So
New to MVC and have been running through the tutorials on the asp.net website.
I'm a bid new in ASP.net and developing a website that holds user-friendly list

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.