如何通过javascript禁用网格ASP.NET中的列的所有复选框时禁用删除按钮? [英] How to disable delete button when all the checkboxes are disabled of a column in grid ASP.NET by javascript?

查看:47
本文介绍了如何通过javascript禁用网格ASP.NET中的列的所有复选框时禁用删除按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Quote:

我有一个网格,其中我有7列,其中所有复选框都被禁用。如何禁用删除按钮?



如果取消SO行项目列中的所有复选框都被禁用,则应禁用DEL按钮。

I have a grid in which I have 7 columns where all the checkboxes are disabled. How do I disable the delete button?

if all the checkboxes in the Cancel SO Line Item column are disabled then the DEL button should be disabled.





.Aspx文件



.Aspx File

<asp:TemplateField HeaderText="Cancel SO Line Item">
        <ItemTemplate>
        <asp:checkbox ID="cbSOCan" runat="server" ViewStateMode="Enabled" EnableViewState="true"></asp:checkbox>
         </ItemTemplate>

     <asp:LinkButton CssClass="btn btn-primary" ID="btnCancelItem" runat="server" CausesValidation="False"OnClientClick="return Confirmationbox();"> Cancel 
Item</asp:LinkButton>
 <asp:HiddenField id="hdnval" value=0 runat="server"/>




bool oneCheckBoxIsEnabled = false;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
    {
CheckBox cb = e.Row.FindControl("CheckBox1") as CheckBox;
        if (cb.Enabled == true)
        {
            oneCheckBoxIsEnabled = true;
        }
    }
    else if (e.Row.RowType == DataControlRowType.Footer)
    {
        //use the footer row to enable or disable the button
        DeleteButton.Enabled = oneCheckBoxIsEnabled;
    }
}





我的尝试:



已经尝试在asp.net c#中找到rowdatabound中的复选框但是在调试期间它显示按钮已启用但是当我检查元素时它显示为禁用



[ ^ ]

需要帮助!!



What I have tried:

have tried the to find the check box in rowdatabound in asp.net c# but it during debugging it's showing button enabled but when i inspect element it's showing disabled

[^]
need help !!

推荐答案

请参考这个问题:如何在网格ASP.NET中禁用列中的所有复选框时禁用按钮通过javascript / C#? [ ^ ]
Please consult this question: How to disable a button when all the checkboxes in are disabled of a column in grid ASP.NET by javascript/C# ?[^]


这篇关于如何通过javascript禁用网格ASP.NET中的列的所有复选框时禁用删除按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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