elham deljooei

elham deljooei

  • NA
  • 84
  • 73.3k

How to auto sort datagridview when the user enter a new data

Jan 15 2013 4:23 AM
I have a DataGridViewX1 when get its data from Datatable. Now i want to sort it when the clerk add data to sql, DataGridViewX1 automatically sort and show new row.
i tested this code but it isn't correct.
     
            //Fill datatable
            adp = new SqlDataAdapter("FillDataGridViewWithClerk", conn);

            adp.Fill(dtbl);
            grd.AutoGenerateColumns = false;
               
           DataView view = dtbl.DefaultView;

          view.Sort = "clrk_Name, clrk_Family asc";
          grd.DataSource = view;

Answers (1)