【发布时间】:2011-05-20 08:41:40
【问题描述】:
在过去的几分钟里,我一直在试图找出问题所在..
<%@ Page Title="test" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ PreviousPageType VirtualPath="~/Top.aspx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<style>
#pagediv { width: 1500px !important; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#ddModel").change(function () {
var selVal = $(this).find(":selected").text();
var rows = $("#gvTop tr:gt(0)");
alert(selVal);
if (selVal == "ALL") {
$("#gvTop tr").show();
}
else {
var rowToShow = rows.find("td:eq(3)").filter(":contains(" + selVal + ")").closest("tr");
rows.show().not(rowToShow).hide();
}
});
});
</script>
</asp:Content>
现在还不知道。
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:DropDownList ID="ddModel" runat="server" DataSourceID="ddmodelsource" DataTextField="Column1" DataValueField="Column1">
</asp:DropDownList>
<asp:GridView ID="gvTop" runat="server" CellPadding="2" CellSpacing="2" GridLines="Vertical">
</asp:GridView>
</asp:Content>
【问题讨论】:
-
什么是“不工作”? jquery 是否被加载(通过执行 alert('jquery loaded'); 在你的 $(document).ready(function ... >
-
它是否做了一些意想不到的事情或者代码根本没有执行?它是否适用于最小化的非 ASP HTML 原型?
-
@Raoul @jm_ 在
$("#ddModel").change(function () {工作之前添加警报。但是该函数中的 alert() 不起作用。我是否以错误的方式调用 id?
标签: javascript jquery .net asp.net