如何检查链接按钮是否被单击 [英] how to check whether a linkbutton is click or not

查看:48
本文介绍了如何检查链接按钮是否被单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%@ Page Language="C#" AutoEventWireup="true"  CodeBehind="MyApp.aspx.cs"

    Inherits="MyApp" %>

<%@ Register Src="PaginationControl.ascx" TagName="PaginationControl" TagPrefix="uc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>My Applications</title>
    <link href="CSS/style.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="CSS/style-ie.css" />
    <link rel="stylesheet" type="text/css" href="CSS/styles1.css" />
    <style type="text/css">
        </style>
    <%--[if lt IE 7]>
        <link rel="stylesheet" type="text/css" href="style-ie.css" />
    <![endif]--%>
    <link href="css/colorbox.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.7.1.min.js" type="text/javascript" language="javascript"></script>

    <script src="js/jquery.colorbox-min.js" type="text/javascript"></script>

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

     <script type="text/javascript">


function pageLoad(sender, args)
{
    var sm = Sys.WebForms.PageRequestManager.getInstance();
    if (!sm.get_isInAsyncPostBack())
    {
        sm.add_beginRequest(onBeginRequest);
        sm.add_endRequest(onRequestDone);
    }
}

function onBeginRequest(sender,args) {

    $(document).ready(function() {
        var shHide = "0";

        $("#lnk_ShowHide").click(function() {
            shHide = "1";
            alert("clcik")
        });

        if (shHide == "0") {
            ClearHideElement();
        }
    })

    var send = args.get_postBackElement().value;
    $get('container').style.cursor = 'wait';
    $find('mdlPopupPleasewait').show();
}

function onRequestDone()
{
    $get('container').style.cursor = 'auto';
    $find('mdlPopupPleasewait').hide();
}

function ClearHideElement() {


}




</script>


</head>
<body>
    <form id="form2" runat="server">

        <asp:UpdatePanel ID="updMain" runat="server">
    <ContentTemplate>
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>


    </div>


    <div id="container">

        <table class="outline" >


            <!-- end of ribbon links -->
            <!--Start of Collabsible Help-->
            <tr>
                <td class="tdbgcolor">

                    <asp:LinkButton ID="lnk_ShowHide"  runat="server"  OnClick="lnk_ShowHide_Click" Text="my link button"></asp:LinkButton>
                </td>
            </tr>
            <!-- End of Collabsible Help -->
            <!-- start of Tabbed navigation -->
            <tr>
                <td style="background-color: white">
                    <asp:UpdatePanel ID="updMain123" runat="server">
                    <ContentTemplate>
                        <div>
                            <cc1:TabContainer ID="tabMyApps" runat="server"  Width="100%"

                                Visible="true" AutoPostBack="true" ActiveTabIndex="0"  >
                                <cc1:TabPanel runat="server"   HeaderText="tab1" ID="pnlFavourites"

                                    >
                                    <ContentTemplate>
                                    <asp:Panel ID="pnlFavGrid" runat="server">
                                        <table class="outline-tabs">
                                            <tr id="trFavPagiUp"  class="pagination-row">
                                                <uc1:PaginationControl ID="pgFavCtrlUp" runat="server" />
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:UpdatePanel ID="UpdFav" runat="server">
                                                        <ContentTemplate>
                                                            <asp:GridView ID="grdFavourite" runat="server"

                                                      >

                                                    </asp:GridView>
                                                        </ContentTemplate>
                                                    </asp:UpdatePanel>
                                                </td>
                                            </tr>

                                        </table>
                                    </asp:Panel>

                                    </ContentTemplate>
                                </cc1:TabPanel>
                                <cc1:TabPanel runat="server" HeaderText="tab2" ID="pnlAll"

                                     ToolTip="All Applications">
                                    <ContentTemplate>
                                        <table  style="background-color: #f7f8fa;" class="outline-tabs">


                                            <tr>
                                                <td>
                                                    <asp:UpdatePanel ID="updAll" runat="server">
                                                        <ContentTemplate>
                                                            <asp:GridView ID="grdAllApplications" runat="server"

                                                                  >

                                                            </asp:GridView>
                                                        </ContentTemplate>
                                                    </asp:UpdatePanel>
                                                </td>
                                            </tr>

                                        </table>
                                    </ContentTemplate>
                                </cc1:TabPanel>


       <asp:Panel runat="server" ID="PleaseWaitMessagePanel" CssClass="wrapText" Style="display: none;">
            <div class="overlay">

                <asp:Panel ID="Panel2" runat="server" Wrap="true" CssClass="body"  >
                    <table cellpadding="5" cellspacing="5" style="width:322px; height:245px; border:1">
                        <tr>
                            <td style="width:322px; height:245px; border:1">
                                <asp:Image ID="imgLoad" Width="322px" Height="245px" BorderWidth="0" runat="server" ImageUrl="Images/loading.gif" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </div>
            <div class="underlay">
            </div>
        </asp:Panel>
     <asp:Button ID="HiddenButton" Style="display: none" runat="server" CssClass="hidden"

            Text="Hidden Button" ToolTip="Necessary for Modal Popup Extender" />
       <cc1:ModalPopupExtender ID="mdlPopupPleasewait" BackgroundCssClass="modalBackground"

        runat="server" BehaviorID="mdlPopupPleasewait" TargetControlID="HiddenButton"

        DropShadow="false" PopupControlID="PleaseWaitMessagePanel">
        </cc1:ModalPopupExtender>

        <div id="footer">
        </div>
    </div>
            </ContentTemplate>
    </asp:UpdatePanel>
    </form>

</body>
</html>



我用其他逻辑做了我的要求,但是为什么不能找到链接按钮是否被单击.我的警报也没有执行.



i did my requirment with some other logic,but why am not able to do find whether the linkbutton is clicked or not.my alert is not got executed also.

推荐答案

(文档).就绪(功能(){ var shHide = " ;
(document).ready(function() { var shHide = "0";


(" ).click(功能(){ shHide = " ; 警报(" ) }); 如果(shHide == " ){ ClearHideElement(); } }) var send = args.get_postBackElement().value;
("#lnk_ShowHide").click(function() { shHide = "1"; alert("clcik") }); if (shHide == "0") { ClearHideElement(); } }) var send = args.get_postBackElement().value;


get(' 容器').style.cursor = ' 等待';
get('container').style.cursor = 'wait';


这篇关于如何检查链接按钮是否被单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆