jquery 无法在 .net 2.0 中工作
我有 vs 2005 和 .net 2.0 ...我的代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edw.aspx.cs" Inherits="BenefitsPaymentSystem.Edw" MasterPageFile="~/Main.Master" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="EDWContent" runat="server">
<asp:Panel ID="pnlSearchEDW" GroupingText="Search Enterprise Dataware House " runat="server" CssClass="panel">
<asp:RadioButtonList Visible="false" ForeColor="midnightblue" ID="rblEDWSearchOtpions" runat="server" RepeatDirection="Horizontal" CellPadding="5" CellSpacing="10" OnSelectedIndexChanged="rblEDWSearchOtpions_Change" AutoPostBack="true" >
<asp:ListItem Text="Client Serach" Value="Client"></asp:ListItem>
<asp:ListItem Text="Program Area Search" Value="Program"></asp:ListItem>
</asp:RadioButtonList>
<a id="lnkSearch" href="#" onclick="slidein();return false;">Begin Client Search</a>
<br />
<br />
</asp:Panel>
<br />
<br />
<div id="clientdiv">
<asp:Panel id="pnlClientSearch" runat="server" CssClass="panel" Visible="true" GroupingText="Client Search">
<table>
<tr>
<td class="textCell">Case# and Suffix</td>
<td class="dataCell">
<asp:TextBox ID="txtCaseAndSuffix" runat="server"></asp:TextBox>
</td>
<td class="textCell">SSN</td>
<td class="dataCell">
<asp:TextBox ID="txtSSN" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="textCell">CIN</td>
<td class="dataCell">
<asp:TextBox ID="txtCIN" runat="server"></asp:TextBox>
</td>
<td class="textCell">First/Last Name</td>
<td class="dataCell">
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</div>
<asp:Panel ID="pnlProgramAreaSearch" runat="server" CssClass="panel" Visible="false" GroupingText="Program Area Search">
<table>
<tr>
<td class="textCell"></td>
<td class="dataCell">
<asp:DropDownList ID="dddPrgramSearchList" runat="server" CssClass="ddl" Width="150pt">
<asp:ListItem Text="PA" Value="PA"></asp:ListItem>
<asp:ListItem Text="NPA" Value="NPA"></asp:ListItem>
<asp:ListItem Text="MA" Value="MA"></asp:ListItem>
<asp:ListItem Text="ALL" Value="ALL"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</asp:Panel>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
alert('');
});
function slidein()
{
alert('');
$('#ctl00_ContentPlaceHolder1_pnlClientSearch').fadeIn('slow',3000);
//$('#clientdiv').fadeIn('slow');
//retunr false;
}
</script>
fadeIn 不起作用...尽管 jquery 文档已准备好被调用.... 我没有任何脚本错误......我希望面板滑入......我也尝试了滑入......
I have vs 2005 and .net 2.0 ...my code is as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Edw.aspx.cs" Inherits="BenefitsPaymentSystem.Edw" MasterPageFile="~/Main.Master" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" ID="EDWContent" runat="server">
<asp:Panel ID="pnlSearchEDW" GroupingText="Search Enterprise Dataware House " runat="server" CssClass="panel">
<asp:RadioButtonList Visible="false" ForeColor="midnightblue" ID="rblEDWSearchOtpions" runat="server" RepeatDirection="Horizontal" CellPadding="5" CellSpacing="10" OnSelectedIndexChanged="rblEDWSearchOtpions_Change" AutoPostBack="true" >
<asp:ListItem Text="Client Serach" Value="Client"></asp:ListItem>
<asp:ListItem Text="Program Area Search" Value="Program"></asp:ListItem>
</asp:RadioButtonList>
<a id="lnkSearch" href="#" onclick="slidein();return false;">Begin Client Search</a>
<br />
<br />
</asp:Panel>
<br />
<br />
<div id="clientdiv">
<asp:Panel id="pnlClientSearch" runat="server" CssClass="panel" Visible="true" GroupingText="Client Search">
<table>
<tr>
<td class="textCell">Case# and Suffix</td>
<td class="dataCell">
<asp:TextBox ID="txtCaseAndSuffix" runat="server"></asp:TextBox>
</td>
<td class="textCell">SSN</td>
<td class="dataCell">
<asp:TextBox ID="txtSSN" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="textCell">CIN</td>
<td class="dataCell">
<asp:TextBox ID="txtCIN" runat="server"></asp:TextBox>
</td>
<td class="textCell">First/Last Name</td>
<td class="dataCell">
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
</td>
</tr>
</table>
</asp:Panel>
</div>
<asp:Panel ID="pnlProgramAreaSearch" runat="server" CssClass="panel" Visible="false" GroupingText="Program Area Search">
<table>
<tr>
<td class="textCell"></td>
<td class="dataCell">
<asp:DropDownList ID="dddPrgramSearchList" runat="server" CssClass="ddl" Width="150pt">
<asp:ListItem Text="PA" Value="PA"></asp:ListItem>
<asp:ListItem Text="NPA" Value="NPA"></asp:ListItem>
<asp:ListItem Text="MA" Value="MA"></asp:ListItem>
<asp:ListItem Text="ALL" Value="ALL"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</asp:Panel>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
alert('');
});
function slidein()
{
alert('');
$('#ctl00_ContentPlaceHolder1_pnlClientSearch').fadeIn('slow',3000);
//$('#clientdiv').fadeIn('slow');
//retunr false;
}
</script>
The fadeIn is not working...altough the jquery document ready is being callledd....
I dont have any script errors ....I want the panel to slide in...I aslo tried out the slidein as well....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要么从链接中删除 href="#" 属性,要么在lidein() 函数末尾“return false”以防止导航离开页面。
另请查看 http://api.jquery.com/event.preventDefault/ 了解如何以 jQuery 方式防止默认事件行为。
either remove the href="#" attribute from your link, or "return false" at the end of your slidein() function to prevent navigating away from the page.
also check out http://api.jquery.com/event.preventDefault/ to see how to prevent default event behavior the jQuery way.
如果不查看更多代码,不确定,但我会尝试两件事 -
首先,在脚本调试器中,验证面板的 clientID 确实是 ctl00_ContentPlaceHolder1_pnlClientSearch。
其次,同样在脚本调试器中,验证 $('#ctl00_ContentPlaceHolder1_pnlClientSearch) 是否解析为 jquery 对象。
Not sure without looking at more code, but two things I would try-
First, in a script debugger, verify that the clientID of the panel is indeed ctl00_ContentPlaceHolder1_pnlClientSearch.
Second, also in a script debugger, verify that $('#ctl00_ContentPlaceHolder1_pnlClientSearch) resolves to a jquery object.
在事件处理程序中返回 false 以防止链接重新加载页面:
您还可以在 jQuery 代码中挂钩事件处理程序,并使用
preventDefault
方法:Return false in the event handler to keep the link from reloading the page:
You can also hook up the event handler in the jQuery code instead, and use the
preventDefault
method: