Results 1 to 2 of 2

Thread: Datagrid problems

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2002
    Location
    Reading
    Posts
    70

    Datagrid problems

    I'm developing a web based application that displays information about a list of files to a user.

    One of the things I want to do is display whether or not the file in question is color or black and white. The database that this information is stored in stores black and white as a boolean value.

    What I would like to do is state either the word "Color" (if the boolean is True or "Black and White" if boolean if false in the column, but I'm not sure how to do this. Can anyone give me some help here?

    Thanks,

    AuldNick

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    In the html, put something like this for the text value:
    Code:
    <%# MyMethod((bool) DataBinder.Eval(Container.DataItem, "Color")) %>
    In the code, make a public function that returns a string and accepts a boolean:
    Code:
    public string MyMethod(bool isColor)
    {
         if(isColor)
             return "Color";
         else
            return "Black and White";
    }
    I didn't get to test the code, but you understand don't you?
    If you need more help, I can acutally do it in VS and send you the exact code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width