convert sentence to C#

D

Daniel

Hi, I have this sentence, Container.DataItem("Free")="Y", in VB.Net and I
need it in C#. Basically it compares the value and if value equals Y then a
True is return. (this is in aspx). Can somebody help me to translate it ?

<asp:CheckBox id="CheckBox1" runat="server" Checked='<%#
Container.DataItem("Free")="Y" %>'>
 
N

Nicholas Paldino [.NET/C# MVP]

Daniel,

You should be able to use:

Container.DataItem["Free"] == "Y"

And it should work. In C#, the comparison operator is "==", while the
assignment operator is "=". Also, indexers in C# use square brackets, and
not parenthesis.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top