1

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>

1 Answer 1

1

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" : "" %> ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.