最後10分問一問題 有一gridview,如何比較兩列的值,如果後一列的值大於前一列的,則為紅色顯示,謝謝 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 两列应该绑定在不同的字段a,b,用一个方法来实现判断:<%# DataBinder.Eval(Container.DataItem,"a")%> <%# Compare(DataBinder.Eval(Container.DataItem,"a").ToString(),DataBinder.Eval(Container.DataItem,"b").ToString())%>public string Compare(string a,string b){string str; if (b>a) { str="<font color='red'>"+b+"</font>"; } else { str=b; } return str;} GridView1_RowDataBound可以嗎?可是我不太會用gridviewrow protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { DataRowView mydrv = ds.Tables[0].DefaultView[i]; int prod = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "一周實際生產能力")); int order = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "一周業務接單量")); if (order < prod) // e.Row.BackColor = System.Drawing.Color.Yellow; GridView1.Rows[i].Cells[3].BackColor = System.Drawing.Color.Red; } }好像不行 asp.net (c#)简单的登录,有错,=高人 web集群&form验证 网页对话框的问题 我快被这个问题折磨疯了~~~高手解救我~~ 请问如何用.NET(C#)实现图片上传功能,有例子吗,谢谢 在repeater里的<ItemTemplate>加入了datagrid控件,datagrid里的数据总是覆盖掉 网页上无法播放数据库中音视频数据问题 水晶报表 急救 急!向高手请教:如何让保存到数据库的文章保持格式??? 各位大侠,请教dataGrid问题? asp中的byval对应C#中的是什么? 用接口定义一个变量是啥个意思啊?
<%# DataBinder.Eval(Container.DataItem,"a")%> <%# Compare(DataBinder.Eval(Container.DataItem,"a").ToString(),
DataBinder.Eval(Container.DataItem,"b").ToString())%>
public string Compare(string a,string b)
{
string str;
if (b>a)
{
str="<font color='red'>"+b+"</font>";
}
else
{
str=b;
}
return str;
}
{
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
DataRowView mydrv = ds.Tables[0].DefaultView[i];
int prod = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "一周實際生產能力"));
int order = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "一周業務接單量"));
if (order < prod)
// e.Row.BackColor = System.Drawing.Color.Yellow;
GridView1.Rows[i].Cells[3].BackColor = System.Drawing.Color.Red;
}
}
好像不行