-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") %>'
Kani
  • 47
  • 2
  • 15

2 Answers2

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

Amul Harad
  • 148
  • 4
0

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

Amarnath R Shenoy
  • 5,121
  • 8
  • 24
  • 32