DataGrid的小问题 用DataGrid捆绑学生成绩表,则样才能使低于60分的那些分数现红色,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写个后台方法:private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if(e.Cell[2].Text < 60 ) { e.Item.BackColor = Color.Red; e.Cell[2].Text = "<font color=red>"+e.Cell[2].Text+"</a> //或者字体变颜色 } else { e.Item.BackColor = Color.Green; } } 谢谢能不能告诉我e.Cell[2]的意思,我是菜鸟 这个比较直观:前台原来绑定代码:<%# DataBinder.Eval(Container, "DataItem.ClassID") %>前台后来绑定代码:<%# red(DataBinder.Eval(Container, "DataItem.ClassID")) %>后台写一个类 public string red(int a){string q;if (a>60){q=<font color=red>a</font>;}else{q=a;}return q;} 楼主可以查一下SDK获得更详细的说明. 求助,添加模板AJAX Control Toolkit Web Site不成功,急 asp.net mvc 中怎么使用CuteEditor? cs调用js方法的问题 如何用C#实现QQ的网络设置 jmail为何不能发附件呀...收到的邮件出现乱码 asp.net中关于无限级下拉菜单的实现 如何让flash 播放器支持多种图片格式?? 一个很麻烦的问题~~~关于Datagrid (c#) sina的下载!! 急:一个页面上不能有两个TreeView吗? 救命,我装了msdn 现在不知为何搜不出东西 筛选依椐里面也没有显示 现在是n多问题急着查不到答案 如何获取镶嵌网页的父网页地址?
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Cell[2].Text < 60 )
{
e.Item.BackColor = Color.Red;
e.Cell[2].Text = "<font color=red>"+e.Cell[2].Text+"</a> //或者字体变颜色
}
else
{
e.Item.BackColor = Color.Green;
}
}
后台写一个类 public string red(int a)
{
string q;
if (a>60)
{
q=<font color=red>a</font>;
}
else
{
q=a;
}
return q;
}