tertiary operator
-
There is a bit type field in my database , which stores 0 0r 1 i am writing the following code
<asp:Label ID="lname" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"HighAltitude").ToString()=="0" ? "Normal" : "High" %>'></asp:Label>
I have two records in my database , first occupy 0 and other occupy 1 but my both records in the gridview shows High status. Please help.Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
There is a bit type field in my database , which stores 0 0r 1 i am writing the following code
<asp:Label ID="lname" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"HighAltitude").ToString()=="0" ? "Normal" : "High" %>'></asp:Label>
I have two records in my database , first occupy 0 and other occupy 1 but my both records in the gridview shows High status. Please help.Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
do you mean in the label they both show as high, dont you need to do something like this if (datafield == '0') { label = high } else if (datafield == '1') { label = low } what youve put above doesnt make sense i dont think
i was trying to do like the iif in vb.net and same can be done in c# via a == 1 ? "2" : "3" and i want to do in the html file, not in code behind.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
-
There is a bit type field in my database , which stores 0 0r 1 i am writing the following code
<asp:Label ID="lname" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"HighAltitude").ToString()=="0" ? "Normal" : "High" %>'></asp:Label>
I have two records in my database , first occupy 0 and other occupy 1 but my both records in the gridview shows High status. Please help.Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
You should do this in code behind. Why would you use code in mark-up? This is Asp.Net not Classic Asp. Do this: in Code behind (probably in the DataBound event or whatever is appropriate to what you are trying to accomplish): string highAltitude = (HighAltitude == 0) ? "Normal" : "High"; this.lname.Text = highAltitude;