Getting error in gridview using object data source
It is displaying empty in gridview i think problem in Business Object. please help me. I am fed up i am trying from last night.
in BO.cs
namespace Business_Object
{
public class company:Icompany
{
int _empid=0 ;
public int empid
{
set
{
if (value != _empid)
_empid = value;
}
get
{
return _empid;
}
}
string _empname ;
public string empname
{
get
{
return _empname;
}
set
{
value = _empname;
}
}
int _jobid ;
public int? jobid
{
get
{
return _jobid;
}
set
{
value = _jobid;
}
}
DateTime _hiredate;
public DateTime? hiredate
{
get
{
return _hiredate;
}
set
{
value = _hiredate;
}
}
}
}
in BLL.cs
namespace BLL
{
public class Employees
{
public List<company> GetEmployees()
{
company c = new company();
CompanyDataContext db=new CompanyDataContext();
List<company> listemp=new List<company>();
listemp = (from p in db.Employees
select new company { empid = c.empid, empname = c.empname, jobid = c.jobid, hiredate = c.hiredate }).ToList();
return listemp;
}
}
}
in default.aspx.cs
<asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="empid" HeaderText="empid" SortExpression="empid" />
<asp:BoundField DataField="empname" HeaderText="empname"
SortExpression="empname" />
<asp:BoundField DataField="jobid" HeaderText="jobid" SortExpression="jobid" />
<asp:BoundField DataField="hiredate" HeaderText="hiredate"
SortExpression="hiredate" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="BusinessObject.ompany" TypeName="BLL.Employees" SelectMethod="GetEmployees">
</asp:ObjectDataSource>