Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
<%@ 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.
Posted
Updated 1-Aug-12 21:20pm
v3
Comments
[no name] 30-Jul-12 16:56pm    
What does your onBeginRequest script have to do with the linkbutton OnClick event defined in your server-side code behind?
Sergey Alexandrovich Kryukov 30-Jul-12 17:13pm    
Big confusion -- I have a problem to explain it; but I tried -- please see.
--SA

You can write the code like below-
HTML
$("#lnkbuton").click(function() {
  alert("linkbutton is clicked.");
});
Refer .click()[^]

---------------------------
Adding another guess ->

Just a suggestion- Please check the id of the linkbutton in the source.
I think it is not "lnkbuton", it is something like "ct.........lnkbutton", which is the clientID.
to know more about ClientID - ASP.NET 4.0 ClientID Overview[^].

If this is the case, then you have to do like below-
HTML
$("#<%= lnkbuton.ClientID %>").click(function() {
  alert("linkbutton is clicked.");
});

Try doing this and let me know.

Updating again as per new code post
------------------------------------
The code inside your script tags is incorrect which is as below...
<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>


You can check my answer how to show asp:UpdateProgress above the form[^] for this kind of task where
InitializeRequest
and
EndRequest
functions are used.
You can check Programming UpdateProgress Controls in Client Script[^] for your reference.

Thanks...
 
Share this answer
 
v5
Comments
Sergey Alexandrovich Kryukov 30-Jul-12 17:13pm    
First part is correct, but the second part is not what OP probably thinks of -- the problem is a very big confusion and lack of simple logic. So I voted 4.
Please see my answer where I tried to explain it (which is not easy -- on that "level").
--SA
Yes you are right --SA. Actually I was searching for it and I found the 2nd link in between this. Sorry for the same.
And what I am thinking is OP is missing something in his code so that he can't do it with the first code...
Sergey Alexandrovich Kryukov 30-Jul-12 23:05pm    
The problem in some basic understanding...
--SA
Yes...
Hope my updated answer helps OP.
Fingers crossed.
software_Engi08 30-Jul-12 17:41pm    
i tryied but still not work.
There is no such thing. Clicked is an event, not a condition. In other words, not that you don't know how to determine if something "is click" or not, the problem is that nothing can be "clicked" or "not clicked". The whole idea is wrong; you cannot try to compare click with Boolean value. Moreover, you cannot compare a call to .click() to anything. What you can do is adding a handler to it. See the example here:
http://api.jquery.com/click/[^].

Pay attention to the first sample in the article referenced above. However, I don't know how to explain it fast, considering your great degree of confusion. Basically, the programming paradigm is: you are not calling event handlers, you tell the system what do call when an event happens. Better now? I'm not sure you are ready to get it right now though; a whole detailed article could help…

By the way, the whole idea of comparing anything with true or false is wrong (showing that you even have no idea of Booleans, comparison and conditional operator, sorry to say so, but for you, it would be the best for you to learn it; understanding events is way more difficult than that). If you have
JavaScript
var value = //...

then
JavaScript
if (value) //...
//is the same as
if (value == true) ... //so, this makes no sense


And please, don't ask "what should I do?"; you won't get your code "fixed", because the whole idea makes no sense. If you explain your goal, that might help. Also, look at existing jQuery samples. But better yet, you should first learn very basic programming and JavaScript topics.

—SA
 
Share this answer
 
v2
Comments
software_Engi08 30-Jul-12 17:41pm    
actually i have a link button and a tabcontainer with 2 tab ,when a user click on the tab i am clearing the data in the gridview,but when the user click on the linkbutton i dont want 2 clear the data .this is the reason i want to find linkbutton is click or not.
software_Engi08 30-Jul-12 17:44pm    
i did something like this.
var shHide = "0";

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

if (shHide == "0") {
ClearHideElement();
}
Sergey Alexandrovich Kryukov 30-Jul-12 18:25pm    
Yes, it should work. This is called "closure". The call context is preserved (converted to a "closed set") to keep shHide flag for the time needed to support the life time of the handler. Actually, all this code should be in the handler of document.ready, $(document).ready(function(){/ * that is, here */}). Did you do this way?

Anyway, if it works for you, consider accepting the answer formally (green button) -- thanks.
--SA
software_Engi08 30-Jul-12 18:55pm    
still not working,i added the code $(document).ready(function(){/ * that is, here */}) ,i also added a alert as shHide="1";
alert("click"),but alert never get executed.
Sergey Alexandrovich Kryukov 30-Jul-12 19:16pm    
Do you have JavaScript debugger operational? Did you get it right? You should not add this code with "/* ... */", you should insert your code in it. Do you understand why?
Ah, of course it could not work. How? You should write all the code in the handler of "click". Your next lines will be executed only once, isn't that obvious?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900