Reputation: 303
i am using the below code to disable the header checkbox whether an item status is "Y". I try this method to disable the asp.net checkbox but i can't do this in html chackbox. Can anyone help me to do this?
<asp:TemplateField>
<HeaderTemplate>
<input id="chk_invoice" type="checkbox" onclick="CheckAllinvoice(this)" runat="server" disabled='<%# (Eval("FLD_STATUS").ToString() == "Y") ? "disabled":"enabled" %>' />// ERROR HERE
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" Checked='<%# (bool)(Eval("FLD_PAID").ToString() == "Y") ? false:true %>'
Enabled='<%# (bool)(Eval("FLD_PAID").ToString() == "Y") ? false:true %>' />
</ItemTemplate>
<ItemStyle Width="20px" />
</asp:TemplateField>
Upvotes: 1
Views: 347
Reputation: 38200
disabled
is something like a boolean attribute when present it implies that the checkbox is to be disabled.
So i guess you should try something like
.. runat="server" <%# (string)Eval("FLD_STATUS") == "Y" ? "disabled" : "" %> ...
Upvotes: 1