我的GridView里有一列是考试题目的对与错。
从数据库中取出来是1或0(int)
我想修改为对或错,请问如何修改。
在什么事件中修改
麻烦简单写一下代码多谢了

解决方案 »

  1.   

    在GridView的事件中做个判断就行 
    用IF else就行
     如果是1显示对,0显示错
    然后绑定一个LABLE 
      

  2.   


        void CustomeRowDataBound(Object sender, GridViewRowEventArgs e)
        {        if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Display the company name in italics.
                e.Row.Cells[索引值].Text = (int.Parse(e.Row.Cells[索引值].Text) == 1) ? "对" : "错";        }    }
           <asp:GridView ID="GridView1" runat="server" OnRowDataBound="CustumRowDataBound">
           </asp:GridView>
    GridView的其余的设置和绑定代码自己写吧。