0

我在复选框和文本框等控件中有一个gridview。对于 Checkbox,Gridview 的 RowCommand 事件中没有类似按钮的 CommandName 属性可供使用。每当复选框选中状态发生更改时,我需要在gridview之外启用一些按钮。有没有其他方法可以实现这一目标?

下面是我尝试过但按钮未启用的代码片段,

<asp:CheckBox ID="chkFee" runat="server" AutoPostBack="true" OnCheckedChanged="chkFee_Changed" />   

           protected void chkFee_Changed(object sender, EventArgs e)
            {
                BtnCalculate.Enabled = true;
                btnSubmit.Enabled = false;                
            } 
In Javascript is called before the this Checkedchanged event,
 function Calc(obj) {

            var BtnCalculate = document.getElementById("<%= BtnCalculate.ClientID %>");
               BtnCalculate.disabled = true;
}      
4

1 回答 1

0

这是 .aspx 文件........

   <asp:CheckBox ID="chkBook" runat="server" 
    AutoPostBack="true" OnCheckedChanged="chkBook_Changed" />

这是cs文件…………

protected void chkAssignAll_CheckedChanged(object sender, EventArgs e)
            {

                GridViewRow gr = (GridViewRow) ((DataControlFieldCell) ((CheckBox) sender).Parent).Parent;
                CheckBox chk1 = (CheckBox) gr.FindControl("chkAssignSun");
                CheckBox chk2 = (CheckBox) gr.FindControl("chkAssignMon");

                chk1.Checked = ((CheckBox) sender).Checked;
                chk2.Checked = ((CheckBox)sender).Checked;                    
            }

试试这个代码............

于 2013-04-23T08:22:42.413 回答