我正在使用这样的模板创建分层网格:
GridViewTemplate template = new GridViewTemplate();
template.DataSource = query;
GridViewTextBoxColumn txtcolumn = new GridViewTextBoxColumn();
txtcolumn.FieldName = "Mobile";
txtcolumn.Name = "colMobile";
txtcolumn.HeaderText = "Mobile Number";
template.Columns.Add(txtcolumn);
正如您所见,标题文字只是一个简单的string
,如何将其绑定到field
的{{1}}?可能的?
答案 0 :(得分:0)
FieldName 属性实际上用于将列绑定到数据源字段。
例如,假设您的数据源包含两个字段, ID 和 UserName 。
如果您想在 RadGridView 中添加一个反映 UserName 字段及其值的列,您只需要设置 FieldName = "您的专栏的用户名" 。
HeaderText 属性用于设置将在您的应用程序中显示的列的列标题文本。
例如,如果您要添加一个显示 UserName 字段值的列,但列名称将显示为用户名,则必须设置 FieldName =" UserName" 和 HeaderText ="用户名" 。