How to Convert DateTime to boolean in ASP.NET GridView?

EnollaSaint

New Member
I have a column with DateTime datatype. i want to display value of this column as Yes/No in GridView in ASP.NET. if DateTime field "Is Null" then Display "No" and If Datetime field column "Is Not Null" then display "No" in grid view how to do it.Whether to do it in SQL Query or in GridView binding.I have tried in GridView but it fails.I know the following code is wrong & in SQLQuery i have checked it for ISNULL.\[code\]<ItemTemplate> <asp:Label ID="lblOndate" runat="server" Text='<%# Convert.ToBoolean(Eval("OnDate")) ? "Yes" : "No" %>' ReadOnly="true"> </asp:Label></ItemTemplate>\[/code\]Help Appreciated!Thanks in Advance.
 
Back
Top