2011-07-29 44 views

回答

1

我發現這個示例代碼;

protected void wgSubstancesUsed_UpdateRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) 
{ 
    switch (e.Row.DataChanged) 
    { 
     case Infragistics.WebUI.UltraWebGrid.DataChanged.Added: 
      this.InsertRecord(e.Row); 
      break; 

     case Infragistics.WebUI.UltraWebGrid.DataChanged.Modified: 
      this.UpdateRecord(e.Row); 
      break; 

     case Infragistics.WebUI.UltraWebGrid.DataChanged.Deleted: 
      this.DeleteRecord(e.Row); 
      break; 

    } 

} 

private void DeleteRecord(UltraGridRow theGridRow) 
{ 
    //Get the GUID of the record you wish to delete from the grid (for me 
    // the first hidden field of the grid 
    Guid thePrimaryKey = new Guid(theGridRow.Cells[0].Value.ToString()); 
    if (thePrimaryKey != null) 
    { 
     busClientObject oClient = new busClientObject() 
oClient.Load(thePrimaryKey); //Get to the individual record, load it into the object 
     oClient.DataRow.Delete(); //Mark that record for deletion 
     oClient.Save(); //Actually delete it 
    } 

} 

而且看看這些文章

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7384

http://forums.infragistics.com/forums/p/24697/90536.aspx

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7384

2

我會建議從列表中刪除該WinGrid綁定到項目,這將將其從網格中刪除。如果您知道列表中項目的索引,則可以使用RemoveAt方法將其從列表中刪除。

如果您有對希望刪除的UltraGridRow對象的引用,那麼可以使用將UltraGridRow的ListObject屬性傳遞給列表的Remove方法的Remove方法。

Alan

相關問題