using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public
partial
class
_Default : System.Web.UI.Page
{
protected
void
Page_Load(object sender, EventArgs e)
{
if
(!IsPostBack)
{
grdEmp.DataSource = Person.Persons;
grdEmp.DataBind();
}
}
}
[Serializable]
public
class
Person
{
public
string FirstName {
get
;
set
; }
public
string LastName {
get
;
set
; }
public
int
Phone {
get
;
set
; }
public
string Email {
get
;
set
; }
public
static
List<Person> Persons
{
get
{
return
new
List<Person>()
{
new
Person(){FirstName=
"Raj"
,LastName=
"Singh"
,Phone=
1213123
,Email=
"raj@gmail.com"
},
new
Person(){FirstName=
"Shankar"
,LastName=
"Singh"
,Phone=
1213123
,Email=
"shankar@gmail.com"
},
new
Person(){FirstName=
"Sonu"
,LastName=
"sharma"
,Phone=
1213123
,Email=
"sonu@gmail.com"
},
};
}
}
public
override
string ToString()
{
return
string.Format(@
"FirstName {0} & LastName {1} Phone {2} Email {3}"
,
this
.FirstName,
this
.LastName,
this
.Phone,
this
.Email);
}
}