S
sean_walsh
I have a gridview with an imagebutton, and I pass the value of a field
to a function to retrieve which URL to use for the image. So in the
gridview I have this:
ImageUrl='<%# GetEnabledImage(Eval("Enabled")) %>'
In my codebehind, I want the function to handle three options: True,
False & Null. It would be ideal if I could declare the function as
something like this:
protected string GetEnabledImage(System.Data.SqlTypes.SqlBinary
Enabled)
....and then check the null status, or the value. That would be clean &
elegant. However, from what I understand, the DBNull type object gets
passed instead of the SqlBinary if the value is null in the DB, so the
wrong type is used, so it fails. Is there no way of doing this without
having a messy conditional statement in the gridview?
to a function to retrieve which URL to use for the image. So in the
gridview I have this:
ImageUrl='<%# GetEnabledImage(Eval("Enabled")) %>'
In my codebehind, I want the function to handle three options: True,
False & Null. It would be ideal if I could declare the function as
something like this:
protected string GetEnabledImage(System.Data.SqlTypes.SqlBinary
Enabled)
....and then check the null status, or the value. That would be clean &
elegant. However, from what I understand, the DBNull type object gets
passed instead of the SqlBinary if the value is null in the DB, so the
wrong type is used, so it fails. Is there no way of doing this without
having a messy conditional statement in the gridview?