convert sentence to C#

  • Thread starter Thread starter Daniel
  • Start date Start date
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" %>'>
 
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.
 
Back
Top