怎么修改GridView某一列的数据类型? 我的GridView里有一列是考试题目的对与错。从数据库中取出来是1或0(int)我想修改为对或错,请问如何修改。在什么事件中修改麻烦简单写一下代码多谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在GridView的事件中做个判断就行 用IF else就行 如果是1显示对,0显示错然后绑定一个LABLE 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的其余的设置和绑定代码自己写吧。 ASP.NET 附加已存在的表 dosframer.ocx控件怎么用??? 高手帮忙 Row.ItemArray问题 怎样避免使用这个,因为太不好维护 IIS 突然不认识 aspx? 如何将.asmx指向bin文件夹下子文件夹中的某个.dll文件 VS.Net能不能生成象duwamish那样的安装盘? c#如何替代js函数decodeURIComponent来解码文字 Microsoft.ApplicationBlocks.Data问题 删除DATATABLE指定行的问题! 如何解析IP信息 翻页,页码问题(求教高手)
用IF else就行
如果是1显示对,0显示错
然后绑定一个LABLE
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的其余的设置和绑定代码自己写吧。