This is because on the content page, ASP.NET changes the assigned identifier to something else. If you are viewing the source of the page, you can see it. So an alternative is to access controls with CssClass.
For example, add CssClassto your GridViewandDropDownList
<asp:DropDownList ID="ddModel" runat="server" DataSourceID="ddmodelsource" DataTextField="Column1" DataValueField="Column1" CssClass="dropdown">
</asp:DropDownList>
<asp:GridView ID="gvTop" runat="server" CellPadding="2" CellSpacing="2"
GridLines="Vertical" CssClass="grid">
</asp:GridView>
Now navigate to it from jquery as follows.
$(document).ready(function () {
$(".dropdown").change(function () {
var selVal = $(this).find(":selected").text();
var rows = $(".grid tr:gt(0)");
alert(selVal);
if (selVal == "ALL") {
$(".grid tr").show();
}
else {
var rowToShow = rows.find("td:eq(3)").filter(":contains(" + selVal + ")").closest("tr");
rows.show().not(rowToShow).hide();
}
});
});
source
share