binding format

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Keith G Hicks

    binding format

    I have a sql field called Status (which can be 1, 2, 3 or 4)

    In a details view ItemTemplate I'd like the bound label to show "Open" for
    1, "Closed" for 2, etc. I figure I can do this with the databinding string.

    Bind("status", "<format stuff here>")

    Not sure how to do that or if this is even the best way. What should I do?

    Thanks,

    Keith


  • Keith G Hicks

    #2
    Re: binding format

    Well, I figured out I can do this:

    IIF(Eval("Statu s")=1,"NOP", IIF(Eval("Statu s")=2, "Open",
    IIF(Eval("Statu s")=3, "Win", IIF(Eval("Statu s")=4, "Closed", ""))))

    Not sure if there's a better way but the above works. Open to suggestions
    though.

    Keith


    Comment

    • lue

      #3
      Re: binding format

      If you use VB.NET You can use "Choose" where the "status" is a variable
      from 1 to 4
      CStr(Choose("St atus", "NOP", "Open", "Win", "Closed"))


      Regards


      "Keith G Hicks" <krh@comcast.ne twrote in message
      news:%23RF1JX4a IHA.4140@TK2MSF TNGP04.phx.gbl. ..
      Well, I figured out I can do this:
      >
      IIF(Eval("Statu s")=1,"NOP", IIF(Eval("Statu s")=2, "Open",
      IIF(Eval("Statu s")=3, "Win", IIF(Eval("Statu s")=4, "Closed", ""))))
      >
      Not sure if there's a better way but the above works. Open to suggestions
      though.
      >
      Keith
      >
      >

      Comment

      • Keith G Hicks

        #4
        Re: binding format

        Cool function. Thanks. Didn't know about that. :-)

        Keith

        "lue" <franklue@gmail .comwrote in message
        news:O6PDU4DbIH A.4696@TK2MSFTN GP05.phx.gbl...
        If you use VB.NET You can use "Choose" where the "status" is a variable
        from 1 to 4
        CStr(Choose("St atus", "NOP", "Open", "Win", "Closed"))
        >
        >
        Regards
        >
        >
        "Keith G Hicks" <krh@comcast.ne twrote in message
        news:%23RF1JX4a IHA.4140@TK2MSF TNGP04.phx.gbl. ..
        Well, I figured out I can do this:

        IIF(Eval("Statu s")=1,"NOP", IIF(Eval("Statu s")=2, "Open",
        IIF(Eval("Statu s")=3, "Win", IIF(Eval("Statu s")=4, "Closed", ""))))

        Not sure if there's a better way but the above works. Open to
        suggestions
        though.

        Keith
        >
        >

        Comment

        Working...