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.

1

1 Answer 1

5

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

Text='<%# If(Eval("Approved").ToString().Equals("True"), " Approved ", " Not Approved ") %>'
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.