Asp.net 在gridview中检查Null

Asp.net 在gridview中检查Null,asp.net,Asp.net,我正在数据库中存储图像数据类型。 但是在检查的时候 <asp:LinkButton ID="lbEvidence" runat="server" Text='<%# CheckNull (Eval("Evidence")) %>' 即使数据库中的映像为空,这里objgrid也会获取一个System.Byte[4]值并返回找到的记录。 图像不为空时工作正常 有什么提示吗 Sun当您这样做时会发生什么 protected stri

我正在数据库中存储图像数据类型。 但是在检查的时候

 <asp:LinkButton ID="lbEvidence" runat="server"
                        Text='<%# CheckNull (Eval("Evidence")) %>'
即使数据库中的映像为空,这里objgrid也会获取一个System.Byte[4]值并返回找到的记录。 图像不为空时工作正常

有什么提示吗
Sun

当您这样做时会发生什么

protected string CheckNull(object objGrid)
        {   // checks whether there is evidence file or not

          return (object == null) ? string.empty : "Record Found";  
        }

没有变化。objGrid接受System.Byte[4]如果数据库中的映像为空,则objGrid作为映像时等于什么?数据库中的null是否设置为数据层中的另一个值?:objGrid接受System.Byte[]Text=''。表中的证据是图像数据类型。在此处设置断点:if(object.ReferenceEquals(objGrid,DBNull.Value)),并在即时窗口中查看objGrid@TheGeekYouNeed:objGrid=System.Bytes[4]表示表中的空值。否则它是System.Bytes[…]
protected string CheckNull(object objGrid)
        {   // checks whether there is evidence file or not

          return (object == null) ? string.empty : "Record Found";  
        }