0

Possible Duplicate:
Is there a conditional ternary operator in VB.NET?

I have the folowing code in asp.net for c# website but i have to use this code in vb.net site but i m unable to convert the code even code translator please help me to do this.here is my code

<asp:CheckBox ID="chkStatus" runat="server" 
                            AutoPostBack="true" OnCheckedChanged="chkStatus_OnCheckedChanged"
                            Checked='<%# Convert.ToBoolean(Eval("Approved")) %>'
                            Text='<%# Eval("Approved").ToString().Equals("True") ? " Approved " : " Not Approved " %>' />
                    </ItemTemplate>                    
                </asp:TemplateField>

here i want to change this line Text='<%# Eval("Approved").ToString().Equals("True") ? " Approved " : " Not Approved " %>'

for vb.net site please help me to do this.

Community
  • 1
  • 1
user1583775
  • 45
  • 1
  • 1
  • 8
  • 1
    http://stackoverflow.com/questions/576431/is-there-a-conditional-ternary-operator-in-vb-net – Habib Aug 27 '12 at 09:01

1 Answers1

5

Use the If operator with at least Framework 3.5 (VS 2008):

Text='<%# If(Eval("Approved").ToString().Equals("True"), " Approved ", " Not Approved ") %>'
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939