Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

C#

C1.Win.C1TrueDBGrid.C1DataColumn Col = new C1.Win.C1TrueDBGrid.C1DataColumn();

C1.Win.C1TrueDBGrid.C1DisplayColumn dc;

c1TrueDBGrid1.Columns.Insert(0, Col);

Col.Caption = "Unbound";

dc = c1TrueDBGrid1.Splits[0].DisplayColumns["Unbound"];


Wiki Markup
<span style="color: #008000">//  移除网格最左侧的新加入的列。</span>
c1TrueDBGrid1.Splits\[0\].DisplayColumns.RemoveAt(C1TrueDBGrid1.Splits\[0\].DisplayColumns.IndexOf(dc)); c1TrueDBGrid1.Splits\[0\].DisplayColumns.Insert(0, dc); dc.Visible = true; c1TrueDBGrid1.Rebind(true);
当网格需要显示非绑定列中的值,它将触发{*}UnboundColumnFetch{*}事件,该事件提供给用户行和列的索引,用以识别所请求的网格中的单元格,事件的{*}Value{*}属性是类型对象,默认值为Null,但可以更改为任何所需的值,并将用于填充指定行和列索引单元格的内容。
*To write code in Visual Basic*


Visual Basic

Private Sub C1TrueDBGrid1_UnboundColumnFetch(ByVal sender As Object, ByVal e As
C1.Win.C1TrueDBGrid.UnboundColumnFetchEventArgs) Handles C1TrueDBGrid1.UnboundColumnFetch

...

C#

this.c1TrueDBGrid1.AddRow("John;Doe;11/29/1985"); this.c1TrueDBGrid1.AddRow("Jane;Doe;7/12/1980"); int index = this.c1TrueDBGrid1.AddRows(2); for(int i=index; i < 2; i++)


Wiki Markup
\{     this.c1TrueDBGrid1\[i,"FirstName"\] = "Joe";     this.c1TrueDBGrid1\[i, "LastName"\] = "Doe";     this.c1TrueDBGrid1\[i, "DateOfBirth"\] = new DateTime(2000,1, 15); \}
您已经成功创建了一个非绑定网格。


 添加新行到非绑定网格

通过使用C1TrueDBGrid.NewRow 方法创建一个非绑定网格相同模式的新System.Data.DataRow,可以轻松的为非绑定网格添加新的行,在以下步骤中您将使用C1TrueDBGrid.Rows集合获取非绑定网格的DataRowCollection,并且使用C1TrueDBGrid.NewRow 方法插入一个新的行到非绑定网格的指定索引。完成以下步骤:

...