AfterLoaded數(shù)據(jù)加載之后激發(fā)。
示例:子表加載完之后,將所有的金額總和賦值到主表當(dāng)前行。
Vb.Net |
Public Sub AfterLoaded(sender As Object,e As System.EventArgs) Dim tbl As SmGrid=sender '如果主表當(dāng)前行不為空 If tbl.Relation.ParentGrid IsNot Nothing AndAlso tbl.Relation.ParentGrid.CurrentRowData IsNot Nothing Then '統(tǒng)計(jì)子表中結(jié)果放到主表當(dāng)前行中 tbl.Relation.ParentGrid.CurrentRowData("訂單總額")=tbl.DataTableHelp.Compute("Sum(金額)") End If End Sub |
C# |
public void AfterLoaded(object sender, System.EventArgs e) { SmGrid tbl = sender as SmGrid; // 如果主表當(dāng)前行不為空 if (tbl.Relation.ParentGrid != null && tbl.Relation.ParentGrid.CurrentRowData != null) // 統(tǒng)計(jì)子表中結(jié)果放到主表當(dāng)前行中 tbl.Relation.ParentGrid.CurrentRowData["訂單總額"] = tbl.DataTableHelp.Compute("Sum(金額)"); } |