最初の列のグリッドビューは、ヘッダーと同じです。すなわち、autogeneratecolumnsがtrueの場合と同じ値です。HeaderTextがIntersectと等しい場合RowDataboundで行う必要があります。最初の列のテキスト、黄色に色を変更します。 Desireed Gridview Outputの添付イメージをご覧ください。GridView:OnRowDatabound HeaderTextは、AutoGenerateColumnでColumnTextと同じです。C#Asp.net
HTML
<asp:GridView ID="GvSamples" OnRowDataBound="GvSamples_RowDataBound" runat="server" AutoGenerateColumns="True">
C#
public void BindSamplesGrid()
{
DataTable _dt = new DataTable();
_dt = BL.GetSample(_conn);
GvSamples.DataSource = _dt;
GvSamples.DataBind();
}
protected void GvSamples_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
if (e.Row.Cells[i].Text == e.Row.Cells[i].Text)
e.Row.Cells[i].Text = e.Row.Cells[i].Text.Replace("_", " ");
}
}
}
私はasp.net C#GridViewのを使用しています。
ありがとうございました
あなたにVDをありがとう、しかし、要件は、1列目の行とヘッダが同じであるべきです。添付の画像をご覧ください。もう一度ありがとう – user2394918
私は実装して、それは動作します私の最後のコメントを無視してください、ありがとうVD! – user2394918