0

CSharp を使用して、幅、高さ、境界線の色などをデータテーブルに設定するにはどうすればよいですか。テーブルにクールな外観を与える機能をいくつか追加したいと思います。

    for (int i = 0; i <= 5; i++)
    {
        if (myQuantity[i]!=null && myQuantity[i].Length>0)
        {
            row = dt.NewRow();
            row["Name"] = myName[i];
            row["Quantity"] = myQuantity[i];
            row["Price"] = myPrice[i];

            c = Convert.ToInt32(myQuantity[i]);

            int price = Convert.ToInt32(myPrice[i]) * c;


            row["Amount"] = price;
            // row["ImageUrlPath"] = "~/Images/cross.png";
            dt.Rows.Add(row);

        }
    }

  //  dt.Rows[0].Delete();
    GridView1.DataSource = dt;
    GridView1.DataBind();


} 
4

1 に答える 1

4

DataTableではこれを行うことはできませんが、GridViewの行では行うことができます

例 :

void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{            
   e.Row.CssClass="your css class";
}
}
于 2012-08-02T08:22:49.300 に答える