我正在尝试以下操作,但它说标题行为空?>
private void CreateGridControl()
{
lastCreatedOpportunitiesGrid = new GridView();
BoundField bOportunityCode = new BoundField();
bOportunityCode.DataField = "OpportunityCode";
bOportunityCode.HeaderText = "OpportunityCode";
lastCreatedOpportunitiesGrid.Columns.Add(bOportunityCode);
BoundField bOpportunityName = new BoundField();
bOpportunityName.DataField = "OpportunityName";
bOpportunityName.HeaderText = "OpportunityName";
lastCreatedOpportunitiesGrid.Columns.Add(bOpportunityName);
HyperLinkField bCSLink = new HyperLinkField();
bCSLink.DataNavigateUrlFields = new string[] {"CsLink"};
bCSLink.HeaderText = "CsLink";
bCSLink.Text = @"<img src='" + ResolveUrl("/_layouts/15/xx/xx/Images/cs.gif") + "' /> ";
lastCreatedOpportunitiesGrid.Columns.Add(bCSLink);
lastCreatedOpportunitiesGrid.HeaderRow.CssClass = Constants.CssClasses.HeaderRow;
lastCreatedOpportunitiesGrid.RowStyle.CssClass = Constants.CssClasses.Row;
lastCreatedOpportunitiesGrid.AutoGenerateColumns = false;
lastCreatedOpportunitiesGrid.EmptyDataText = Constants.Messages.NoOpportunitiesFound;
this.Controls.Add(lastCreatedOpportunitiesGrid);
LoadGridData();
}