It is displaying empty in datetime column in gridview.
plz help
BO.cs
public class cmp:Icmp
{
DateTime? _datetime;
public int Employeeid
{
get;
set;
}
public string EmpName
{
get;
set;
}
public int jobid
{
get;
set;
}
public int managerid
{
get;
set;
}
public DateTime? hiredate
{
get { return _datetime; }
set { value = _datetime; }
}
in DAL.cs
public List<cmp> GetEmployees()
{
List<cmp> listemmployees = new List<cmp>();
CompanyDataContext db = new CompanyDataContext();
listemmployees = db.Employees.Select(p => new cmp { Employeeid = p.empid, EmpName = p.empname, hiredate=p.hiredate }).ToList();
return listemmployees;
}
in Default.aspx
<asp:GridView ID="gv1" runat="server" DataSourceID="osd"
AutoGenerateColumns="False" AutoGenerateEditButton="True" DataKeyNames="Employeeid"
AutoGenerateDeleteButton="True" AllowPaging="True" PageSize="3" AutoGenerateSelectButton="true" EnablePersistedSelection="true" >
<Columns>
<asp:BoundField DataField="Employeeid" HeaderText="Employeeid"
SortExpression="Employeeid" />
<asp:BoundField DataField="EmpName" HeaderText="EmpName"
SortExpression="EmpName" />
<asp:BoundField DataField="jobid" HeaderText="jobid" SortExpression="jobid" />
<asp:BoundField DataField="managerid" HeaderText="managerid"
SortExpression="managerid" />
<asp:BoundField DataField="hiredate" HeaderText="hiredate"
SortExpression="hiredate" />
<asp:BoundField DataField="salary" HeaderText="salary"
SortExpression="salary" />
</Columns>
</asp:GridView>