(アクティブ) または非アクティブのActive
いずれかを示す列を持つ GridView があります。1
-1
ただし、これはフロント エンド UI に実装されているため、役に立たない整数と思われるものをユーザーに表示したくありませんが、Active
またはNot active
の GridView に表示されますPage_Load
。
コードは次のようになります-
protected void Page_Load(object sender, EventArgs e)
{
//code here to modify the column 'Active' in the GridView
//GridView ID="GV1"
if (row.Cells[1].Text == "1")
{
row.Cells[1].Text = "Active";
}
if (row.Cells[1].Text == "-1")
{
row.Cells[1].Text = "Not Active";
}
}
そしてGridViewの列は -
<asp:BoundField HeaderText="Active" DataField="Active" SortExpression="Active"></asp:BoundField>
UI をより見やすくするためにデータベースを編集したくないので、どうすればよいですか?