jquery 无法在 .net 2.0 中工作

发布于 2024-11-06 20:12:28 字数 3298 浏览 0 评论 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

陌上青苔 2024-11-13 20:12:28

要么从链接中删除 href="#" 属性,要么在lidein() 函数末尾“return false”以防止导航离开页面。

另请查看 http://api.jquery.com/event.preventDefault/ 了解如何以 jQuery 方式防止默认事件行为。

$(document).ready(function() {
    $('#lnkSearch').click(function(e) {
        e.preventDefault();
        slidein();
    });
});

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.

$(document).ready(function() {
    $('#lnkSearch').click(function(e) {
        e.preventDefault();
        slidein();
    });
});
滥情哥ㄟ 2024-11-13 20:12:28

如果不查看更多代码,不确定,但我会尝试两件事 -

首先,在脚本调试器中,验证面板的 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.

枕花眠 2024-11-13 20:12:28

在事件处理程序中返回 false 以防止链接重新加载页面:

<a id="lnkSearch" href="#" onclick="slidein();return false;">

您还可以在 jQuery 代码中挂钩事件处理程序,并使用 preventDefault 方法:

$(document).ready(function(){
  $('#lnkSearch').click(function(e){
    slidein();
    e.preventDefault();
  });
});

Return false in the event handler to keep the link from reloading the page:

<a id="lnkSearch" href="#" onclick="slidein();return false;">

You can also hook up the event handler in the jQuery code instead, and use the preventDefault method:

$(document).ready(function(){
  $('#lnkSearch').click(function(e){
    slidein();
    e.preventDefault();
  });
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文