本文整理汇总了C#中GridPanel.SetDataSource方法的典型用法代码示例。如果您正苦于以下问题:C# GridPanel.SetDataSource方法的具体用法?C# GridPanel.SetDataSource怎么用?C# GridPanel.SetDataSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridPanel
的用法示例。
在下文中一共展示了GridPanel.SetDataSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNestedPanel
private void CreateNestedPanel(GridPanel panel,
GridRow row, DataRelation dr, StringBuilder sb)
{
DataTable ct = dr.ChildTable;
bool autogen = true;
ProcessChildRelations crProcess = _Panel.ProcessChildRelations;
if (_Panel.SuperGrid.DoDataBindingStartEvent(
_Panel, row, ct.TableName, ref autogen, ref crProcess) == false)
{
sb.Length = 0;
for (int i=0; i<dr.ParentColumns.Length; i++)
{
DataColumn col = dr.ParentColumns[i];
GridColumn gc =
FindGridColumn(panel, col.ColumnName);
if (gc != null)
{
if (sb.Length > 0)
sb.Append(" AND ");
sb.Append("[" + dr.ChildColumns[i] + "]=");
sb.Append("'" + row.Cells[gc.ColumnIndex].Value + "'");
}
}
string t = sb.ToString();
DataView view = new
DataView(ct, t, "", DataViewRowState.CurrentRows);
if (view.Count > 0 ||
_Panel.ProcessChildRelations == ProcessChildRelations.Always)
{
GridPanel ipanel = new GridPanel();
ipanel.Name = ct.TableName;
ipanel.AutoGenerateColumns = autogen;
ipanel.SetDataSource(panel.DataSource);
ipanel.SetDataMember(ct.TableName);
ipanel.DataBinder.DataView = view;
ipanel.DataBinder.BaseDataSource = ipanel.DataSource;
ipanel.DataBinder.BaseDataMember = ipanel.DataMember;
row.Rows.Add(ipanel);
ipanel.DataBinder.AddDataTable(ct, autogen, crProcess);
}
else
{
view.Dispose();
}
}
}