I am trying to add a commandfield in the gridview dynamically. It is working fine, but it is always adding that at first coulum. Is there any way that I can add it on last column? (My gridview data is coming from DataAdapter.
My code:
private void ShowGrid()
{
String SQL = "";
SQL = "Select PatientID,'Status'= Case Submitted When 1 then 'Submitted' else 'Not Submitted' End, convert(varchar(10),CreatedDate,106) as 'Created' From mytable";
SqlDataAdapter da = DBHandler.GetRecordsFromAdapter(SQL);
if (da != null)
{
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count > 0)
{
GridPatients.DataSource = ds;
GridPatients.DataBind();
CommandField mycom= new CommandField();
...
Go to the complete details ...