简体   繁体   English

在单击时激活中继器中的显示链接按钮

[英]Show linkbutton inside Repeater active on click

Generate A to Z linkbutton, I want to show alphabet linkbutton Active on Click. 生成A到Z的链接按钮,我想显示字母链接按钮单击时处于活动状态。 Either by Jquery or Code Behind. 通过Jquery或Code Behind。

<asp:UpdatePanel ID="UpdatePanel3" runat="server">
    <ContentTemplate>
        <asp:Repeater ID="rptAlphabets" runat="server">
            <ItemTemplate>
                <asp:LinkButton ID="lnkAlphabet" runat="server" Text='<%#Eval("Value")%>'  OnClick="Alphabet_Click" CssClass="listbtn" Width="31px" Height="15px" align="center"  CommandName="getalphabet" />

                <div class="clear-list">
                </div>

            </ItemTemplate>
        </asp:Repeater> 
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="rptAlphabets" />
    </Triggers>
</asp:UpdatePanel>

If you mean to highlight the selected button out of the groyp.. Yes you can do it using the CSS and JQuery.. 如果您要突出显示来自groyp的选定按钮。是的,可以使用CSS和JQuery来完成。

use the below snippet... 使用以下代码段...

 <style>
    .listbtn {
        border: 1px solid #bbb;
        border-radius: 2px;
        background-color: #eee;
        text-decoration: none;

        width: auto!important;
        padding: 3px;
    }
    .selected {
        background-color: #222;
        color: white;
    }
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
    $(document).ready(function () {
        $('.listbtn').click(function (e) {
            e.preventDefault();
            $('.listbtn').each(function () {
                $(this).removeClass('selected');
            });
            $(this).addClass('selected');

        });
    });
</script>

I am a little confused. 我有点困惑。 But the code to enable a button would be something like. 但是启用按钮的代码将是类似的。 Button1.enabled=false; Button1.enabled = FALSE; if(checkbox.checked) { Button1.enabled=true; if(checkbox.checked){Button1.enabled = true; } }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM