GridView1 RowDataBound
程序员文章站
2022-05-14 08:32:32
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add... ......
protected void gridview1_rowdatabound(object sender, gridviewroweventargs e)
{
if (e.row.rowtype == datacontrolrowtype.datarow)
{
e.row.attributes.add("onmouseover", "this.name=this.classname;this.classname='selrow';");
e.row.attributes.add("onmouseout", "this.classname=this.name;");
string bwflag = databinder.eval(e.row.dataitem, "bwflag").tostring();
if(bwflag == "b")
{
e.row.cells[3].text = "黑名单";
}
else
{
e.row.cells[3].text = "白名单";
}
//modelblackwhitelist model = row.dataitem as modelblackwhitelist;
linkbutton lkimage = e.row.findcontrol("lkimage") as linkbutton;
//image imgcar = e.row.findcontrol("imgcar") as image;
object carpicpath = databinder.eval(e.row.dataitem, "carpicpath");
if (carpicpath != null)
{
lkimage.postbackurl = "showimage.aspx?carpicpath=" + system.web.httputility.htmlencode(carpicpath.tostring());
}
else
{
lkimage.postbackurl = "#";
}
}
}
上一篇: 【我们一起写框架】MVVM的WPF框架(五)—完结篇
下一篇: 百度将打击下载站的虚假下载