gridview绑定列中字符如何转换

来源:百度知道 编辑:UC知道 时间:2024/05/09 16:48:27
我现在数据库中有一字段。为int型,分别用1-5表示
审核 1为通过,2为待审,3为完成,4为超时,5为放弃

我绑定后要怎么样才能让它显示为文本!!!

添加一个模板列,上面放一个Lable
在ItemDataBound件时作判断就可以了,参考代码
System.Web.UI.WebControls.Image TempIshot; //热点图片
System.Web.UI.WebControls.Image TempIshot; //热点图片
System.Web.UI.WebControls.Label TempIsShowTime;//时间标签

TempIshot=(System.Web.UI.WebControls.Image)e.Item.FindControl("ib_ishot") ;
TempIsShowTime=(System.Web.UI.WebControls.Label)e.Item.FindControl("lblShowTime") ;

if(object.Equals(TempIshot,null)==false)
{
myArticle.getArticleByID(e.Item.Cells[0].Text.Trim());

if (this.Showtime == "" || this.Showtime == null)//显示时间
{
TempIsShowTime.Visible=false;
}
else
{
TempIsShowTime.Visible=true;
}
//热点
string strPath = this.Request.Path;
strPath = HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;
if(myArticle.IsHot == true)
{