-3

This is my html code inside the gridview.. I want to add "OR" condition in Eval function..

how can i do?

<asp:TemplateField HeaderText="Report" HeaderStyle-CssClass="headerfont">
       <ItemTemplate>
          <asp:CheckBox ID="checkReport" runat="server" Checked='<%# bool.Parse(Eval("rm_rights").ToString() == "1R" ? "True": "False") %>'
             Enabled="true" AutoPostBack="True"  /> 
          </ItemTemplate>
          <HeaderStyle CssClass="headerfont"></HeaderStyle>
             <ItemStyle HorizontalAlign="Center" />
           </asp:TemplateField>

i need code like this

`Checked='<%# bool.Parse(Eval("rm_rights").ToString() == "2R" ? "True": "False") %>'`

OR operator

Checked='<%# bool.Parse(Eval("rm_rights").ToString() == "3R" ? "True": "False") %>'
4

2 Answers 2

0

you are using bool function and u evaluate this expression with 1R so it gives u error . remove bool.parse function and check again

Sign up to request clarification or add additional context in comments.

Comments

0

Try this , You have misplaced the bracket ,<%# ... %> block supports conditional operator, eval is a different function " <%# Eval("rm_rights").ToString() == "1R" ? "True": "False" %>"

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.