-
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:confused:
-
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.