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;
How to auto sort datagridview when the user enter a new data
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Akkiraju IvaturiRank #473 · 5.3K reputationPosted Jan 15, 2013, 5:43 AM EST
Put a timer in your page and let it invoke the datagridview binding code for every time interval so that it picks up the latest data inserted in the table.
Otherwise, your asp.net page cannot refresh by itself to get the latest data. Unless you do some operation that post backs the page.
Let me know if you have any questions.