Skip to main content

Bug Tracker

Side navigation

#4487 closed bug (invalid)

Opened April 03, 2009 10:27AM UTC

Closed April 11, 2009 03:33PM UTC

ASP.NET Integration with 2 dropdowns, taking the wrong dropdown's value.

Reported by: alexander Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

I got a dropdown (<select>) in a MasterPage and a dropdown in a contentpage.

They both have differnet ID's, and since one is in a contentpage, it will also get the contentplaceholder's namespace added to its ID, so I'm 100% sure they both get different ID's.

I have a jquery function declared like this in the content page:

$(document).ready(function() {

generateSprites(".nav-top", "current-", true, 300, "slide");

$(".lightbox").lightbox({ fitToScreen: true });

$(".lighttextbox").lightbox({ fitToScreen: true });

$("#<%=ddSize.ClientID %>").change(function() {

var str = $("select option:selected").val();

$("#size").text(str);

})

.change();

});

The problem is, when the dropdown in the masterpage has options in it, this script will take the masterpage's dropdown value instead of the one in the content page, which is named ddSize.

When I dont put options in the masterpage's dropdown, it will work just fine.

Attachments (0)
Change History (2)

Changed April 03, 2009 10:30AM UTC by alexander comment:1

Right, forgot to write. While using ordinary javascript and it works fine.

<select id="ddSize" onchange="SetSize(this);">

function SetSize(dropdown) {

var sp = document.getElementById('size');

sp.innerHTML = dropdown.value;

}

Changed April 11, 2009 03:33PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed
$("#<%=ddSize.ClientID %>").change( ... )

Most likely the ClientID isn't what you think it is. This seems unlikely to be a jQuery bug, but if you can attach a simple test case that reproduces the problem (one that doesn't require ASPX) then reopen the ticket.