Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 更改加载页面上的GridView单元格字符串_C#_Asp.net_Gridview - Fatal编程技术网

C# 更改加载页面上的GridView单元格字符串

C# 更改加载页面上的GridView单元格字符串,c#,asp.net,gridview,C#,Asp.net,Gridview,我有一个GridView,它有一个名为Active的列,显示1(对于Active)或-1(对于inactive) 但是,由于这是在前端UI中实现的,我不希望用户看到他们认为无用的整数,但是活动的或非活动的将显示在页面加载的网格视图中 代码看起来像- protected void Page_Load(object sender, EventArgs e) { //code here to modify the column 'Active' in the GridView

我有一个GridView,它有一个名为
Active
的列,显示
1
(对于Active)或
-1
(对于inactive)

但是,由于这是在前端UI中实现的,我不希望用户看到他们认为无用的整数,但是
活动的
非活动的
将显示在
页面加载的网格视图中

代码看起来像-

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更加美观,如何才能做到这一点?

尝试Gridview事件