Index outof range?GridView2.Columns[6] as BoundField I use Automatica generate field .
How to manipulate GridView2.Columns as BoundField with auto-generate feather?
JobPostDataContext db = new JobPostDataContext();
var query = from j in db.JobLists
join u in db.UserLists
on j.UserID equals u.UserID
where j.JobTitle.Contains(this.TextBox1.Text)
select new
{
j.JobID,
j.JobTitle,
j.Summary,
j.Details,
j.CompanyName,
j.CompanyEmail,
j.DatePosted,
j.UserID,
u.City,
u.State,
u.Country
};
GridView2.DataSource = query;
GridView2.DataBind();
BoundField DatePosted = GridView2.Columns[6] as BoundField;
DatePosted.DataFormatString = "{0:MMM,dd yy}";