Hey, so i have a data grid that needs to be sorted when i am adding a new row
right now it is being sorted by this way when i add a row to the grid
2
1
2
3
4
5
I need it to be sorted like
1
2
2
3
4
5
when they add in the same Rig ID, they Id must be below the exisiting ID on the grid so they can add the info here is my coding that i have
right now it is being sorted by this way when i add a row to the grid
2
1
2
3
4
5
I need it to be sorted like
1
2
2
3
4
5
when they add in the same Rig ID, they Id must be below the exisiting ID on the grid so they can add the info here is my coding that i have
Code:
private void AddOneRigActivity(int tempRigID, string tempRigNumber, int tempprovid, int tempDepthCatID, decimal tempOpDays, decimal tempNonOpDays, decimal tempAppDays, decimal tempETours, bool tempETSFlag)
{
int tempActivityID = GetNextActivityID();
DataRow dr = dtActivityData.NewRow();
int divisionID = CommonTool.ConvertStringToInt(DivisionDropdown.SelectedValue);
int selectedMonth = CommonTool.ConvertStringToInt(MonthDropdown.SelectedValue);
dr["ActivityID"] = tempActivityID;
dr["DivisionID"] = divisionID;
dr["RigID"] = tempRigID;
dr["MonthID"] = selectedMonth;
dr["RigNumber"] = tempRigNumber;
dr["ProvinceID"] = tempprovid;
dr["DepthCategoryID"] = tempDepthCatID;
dr["OperatingDays"] = tempOpDays;
dr["NonOperatingDays"] = tempNonOpDays;
dr["ApplicableDays"] = tempAppDays;
dr["ElectronicTours"] = tempETours;
dr["ETSFlag"] = tempETSFlag;
dtActivityData.Rows.Add(dr);
dgData.DataSource = dtActivityData;
dgData_DataBind();
}
private void dgData_DataBind()
{
dtActivityData.DefaultView.RowFilter = "";
dtActivityData.DefaultView.Sort = "RigNumberLen, RigNumber";
dgData.DataSource = dtActivityData;
dgData.DataBind();
}
Comment