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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:35:29+00:00 2026-06-18T01:35:29+00:00

It is very strange. I have a javascript function to enable the listbox which

  • 0

It is very strange. I have a javascript function to enable the listbox which is disable when it loaded. This javascript function works fine to enable or disable the listbox. However after the user click the save button, it didn’t get the new selected item; always keep the old selected item by databind. I checked the isPostback on Page load. If it is not isPostback, the listbox is not load again. Would someone give me the hint to solve this problem. Thansk in advance.

function enableProject() {           
    var chk=document.getElementById('chkProject');
if (chk.checked) {
    document.getElementById('listProject').disabled = false;
     }
else {
         document.getElementById('listProject').disabled = true;
     }
}

There is my asp.net page

<asp:ListBox id="listProject" runat="server"
    SelectionMode="Multiple" Rows="5" class="w200"  Enabled="false"/>
<asp:checkbox id="chkProject" runat="server"
    Text="Enable" onclick="enableProject()" />

The following code is for check the ListBox:

For Each projectItem In listProject.Items
    If projectItem.Selected Then
        'create a new project object
        Dim objProj As New Data.Project( ID, projectItem.Value)
        objProjects.Add Project(objProj)
    End If
Next
  • 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-18T01:35:30+00:00Added an answer on June 18, 2026 at 1:35 am

    First thing to check is that our not ‘rebinding’ on each postback. If you are that would explain why your getting what you started with. Can you post your code where you are binding the ListBox?

    If the control is disabled on postback then it will not post ‘new’ values and it will just go off of what the ViewState had stored originally for the contrl so make sure that it truely is enabled before the postback.

    Here is a link with an example of that behaviour:

    https://web.archive.org/web/20210420005338/https://aspnet.4guysfromrolla.com/demos/ProblemNotReturningDisabledControls.aspx

    If you want to test if this is the problem set the following property in your form tag which will force disabled controls to be posted back:

    <form id="form1" submitdisabledcontrols="true" runat="server">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very strange problem in which identical pieces of Javascript are behaving
I have encountered a very strange bug in Firefox. I have a javascript function
I have a very strange problem with a Javascript function: function changeContent(url, id) {
I have a function in javascript and it works just fine, but now I
I have a very strange issue. I have an open WebSocket, the communication works
I have a webview with added javascript interface which works perfectly on most devices,
I have a very strange problem with IE8; I have reduced this as much
Still kinda new to ASP.net and I have this strange problem. Its a very
This is a very strange problem. I've got a rails app in which I
I have got a very strange input issue in which it seems that my

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.