Last Updated: February 25, 2016
·
770
· vitochung

grid row mismatch after sorting

//frmStbInv

//frmContractGroupAccountList

private void gv_ShowingEditor(object sender, CancelEventArgs e)
{
    int index = gv.FocusedRowHandle;
    bool chk = selection.IsRowSelected(index);

    if (gv.FocusedColumn.FieldName == "td_no" && !chk)
    {
        //未勾選的資料不可修改票號
        e.Cancel = true;
    }
}


private void SaveSelect()
{
    DataTable dt = gcTop.DataSource as DataTable;
    for (int i = 0; i < dt.Rows.Count; i++)
    {
        DataRow dr = selection.GetRow(i);
        DataRow fdr = MainTable.Rows.Find(new object[] { gno, dr.FieldbyName("pno").asInteger });
        //不可互為母戶子戶
        DataRow gdr = AppFuncs.GetQueryRow(string.Format("SELECT * FROM GroupAccountList WHERE gno = {0} AND pno = {1}",
            dr.FieldbyName("pno").asInteger, gno));