Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdownlist data disapears on jquery hide/show

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
US
I have a dropdownlist that is filled with items.

I show and hide the div surrounding the dropdownlist using the following code.

divPCSelection.Style.Add("display", bo.User ? "none" : "normal");

This hides and show fine.

When I do a post back and look at the pages view source, the div shows the style display:none. The dropdown also shows all the items in the dropdown.

If then do a jquery "show" of the div, the div shows but the dropdown is now empty.

The jquery code is:

Code:
      function TogglePCSelection() {
         if ($("#<%=chkUser.ClientID%>").is(":checked")) {
            $("#<%=divPCSelection.ClientID%>").hide();
         }
         else {
            $("#<%=divPCSelection.ClientID%>").show();
         }
      }

It doesn't seem to actually be empty as I can do a normal postback and the data is now back in the dropdownlist.

What is happening here?

Thanks,

Tom
 
Why you ask this question here?
Here is SQL Server forum, not jquery one.

Borislav Borissov
VFP9 SP2, SQL Server
 
You're right.

I thought I was in the asp.net forum when I wrote it.

I will move it there

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top