Can not convert type system.we.ui.webcontrol.tablecell to system.web.ui.webcontrols.label
Label date = GVitem.SelectedRow.Cells[16].Text as Label;
// Label date = GVCon.SelectedRow.FindControl("Inv_date") as Label;
if ((date.Text) != "")
{
txtopndate.Text = DateTime.ParseExact((GVitem.SelectedRow.FindControl("Inv_date") as Label).Text, "MM/dd/yyyy", CultureInfo.InvariantCulture).ToString("yyyy-MM-dd").Replace(" ", "");
}
else
{
txtopndate.Text = GVitem.SelectedRow.Cells[16].Text.Replace(" ", "");
}
on below line i am getting
Label date = GVitem.SelectedRow.Cells[16].Text as Label;