Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. tertiary operator

tertiary operator

Scheduled Pinned Locked Moved ASP.NET
databasesysadmindockerhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonia Gupta
    wrote on last edited by
    #1

    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.

    E R 2 Replies Last reply
    0
    • S Sonia Gupta

      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.

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • E eyeseetee

        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

        S Offline
        S Offline
        Sonia Gupta
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • S Sonia Gupta

          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.

          R Offline
          R Offline
          R Giskard Reventlov
          wrote on last edited by
          #4

          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;

          me, me, me

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups