How to date show in dd/MM/yyyy format in gridview….
protected void
grvViewApp_RowDataBound(object sender, GridViewRowEventArgs e)
{
dtinfo.ShortDatePattern = "dd/MM/yyyy";
dtinfo.DateSeparator = "/";
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[1].Text = "Enrollment
No.";
e.Row.Cells[6].Text = "Father's
Name";
e.Row.Cells[7].Text = "Diary No.";
e.Row.Cells[8].Text = "Subject
Date";
e.Row.Cells[17].Text = "Annual Subject
Fees";
}
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[8].Text == ""
| e.Row.Cells[8].Text == " "
&& e.Row.Cells[5].Text == ""
| e.Row.Cells[5].Text == " ")
{
}
else
{
e.Row.Cells[8].Text = Convert.ToDateTime(e.Row.Cells[8].Text).ToString("dd/MM/yyyy");
e.Row.Cells[5].Text = Convert.ToDateTime(e.Row.Cells[5].Text).ToString("dd/MM/yyyy");
}
}
}
No comments:
Post a Comment
Thanks for comments.