in the database i have certain date as 01/01/1900.now while displaying this in the data grid along with the other columns i would like to display all the dates having value 01/01/1900 as blank.is it possible to do so?if yes then how?
Use the ItemDataBound or RowDataBound event of the datagrid. This event is fired right after the item is data bound so you can manipulate the formatting of the item based on the data. Search google : "RowDataBound Custom Formatting"
thanks for your suggestion but i am using the same data gridto display data from different tables.so everytime the column no of the date column does not remain same so i cannot use the RowDataBound event.any better solutions?????????
If your data is typed, then you can check the data type, if it is of DateTime, call the function if not do nothing. If your data is not typed, then you can check the data type using regular expressions. If it matches datetime format then call the function else do nothing.
<script language="vb" runat="server">
Function ChkDate(ByVal dt As String) As String
If dt = "01/01/1900" Or dt = "1/1/1900" Then
ChkDate = ""
ChkDate = dt
<%# ChkDate((Eval("Date")).ToString("d")) %>