开发者

paragraph and anchor as a button / how add server side event click

开发者 https://www.devze.com 2023-03-10 04:41 出处:网络
hi my dear firends : i have a button like below : <p id=\"EnterToImagesParag\" class=\"EnterParag\">

hi my dear firends :

i have a button like below :

            <p id="EnterToImagesParag" class="EnterParag">
                <a id="EnterToImagesLink" name="EnterToImagesLink" class="EnterLink">
                </a>
            </p>

and css :

p.EnterParag, p.EnterParag a.EnterLink
{
   width: 400px;
   height: 45px;
   display: block;
}
p#EnterToImagesParag
{
    background: url(/Images/Admin/btnConfigImages.png) 0px -45px;
}
p#EnterToImagesParag a#EnterToImagesLink
{
    background: url(/Images/Admin/btnConfigImages.png) 0px 0px;
}

and jquery Like this :

        $(document.body).ready(function () {
            $('.EnterParag a').hover(
            function () { $(this).stop().animate({ 'opacity': '0' }, 500); },
            function () { $(this).stop().animate({ 'opacity'开发者_JS百科: '1' }, 500); });
});

how can i add server side event click to this button ?

thanks in advance


To clarify, that's not a button, it's an anchor. You can add a server side event by adding runat=server and an event handler for the OnServerClick event.

 <a id="EnterToImagesLink" name="EnterToImagesLink" class="EnterLink" runat="server" OnServerClick="MyClickEvent"> </a>


you can replace the anchor element "a" with ASP.NET control LinkButton control, it will produce the same type of HTML element (anchor/"a") and it provides you with Click event as well (server side).

<asp:LinkButton ID="myLinkButton" runat="server" CssClass="EnterLink" Text="My LinkButton" OnClick="OnServerClickMethod" />
0

精彩评论

暂无评论...
验证码 换一张
取 消