how to bind the converted value from a datatable to my gridview.
- by Ranjana
how to bind the value to gridview
i have a datatable
DataTable dtBindGrid = new DataTable();
dtBindGrid = serviceobj.SelectExamTimeTable(txtSchoolName.Text, txtBranchName.Text, txtClass.Text, txtExamName.Text);
foreach (DataRow row in dtBindGrid.Rows)
{
strgetday= row["Day"].ToString();
strgetdate = row["Date"].ToString();
DatedTime = Convert.ToDateTime(row["Time"].ToString());
strgettime = DatedTime.ToString("t");
strgetsubject = row["Subject"].ToString();
strgetduration = row["Duration"].ToString();
strgetsession = row["Session"].ToString();
strgetminmark = row["MinMarks"].ToString();
strgetmaxmark = row["MaxMarks"].ToString();
// dtBindGrid.Rows.Add(row);
}
GrdExamTimeTable.DataSource = dtBindGrid.DefaultView;
GrdExamTimeTable.DataBind();
this datatable will return me some values like
day,date,time,duration,subject,..
here im getting each value in string bec to convert the Time as 9.00am or 9.00pm
DatedTime = Convert.ToDateTime(row["Time"].ToString());
strgettime = DatedTime.ToString("t");
.... how to bind this converted value to my gridview.