62,243
社区成员




<asp:TemplateField>
<ItemTemplate>
<button id="btn" onclick='alert("<%# DataBinder.Eval(Container.DataItem, "BankName")%>");' ></button>
</ItemTemplate>
</asp:TemplateField>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)//判断是否为数据绑定列
{
string code = e.Row.Cells[0].Text;//获取当前行的主键
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#D6DEE5'");//添加鼠标移动样式
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");//添加鼠标移动样式
//添加修改的前台单击属性
((ImageButton)(e.Row.Cells[10].Controls[1])).Attributes.Add("OnClick", "win=window.showModalDialog('EditTbCredit.aspx?code=" + code + "','open','center:yes;scroll:yes;dialogWidth:450px;dialogHeight:500px;resizable:yes;');");
#region (客户编号到客户名称,产品编号到产品名称)的转换
//从客户编号转变成客户名称
string guestId = e.Row.Cells[1].Text;//得到每一行的第2列的容内
TbguestInfo guest = TbguestBLL.GetModel(guestId);//根据编号查找信息
e.Row.Cells[1].Text = guest.Strname;//把每一行的第2列的编号内容更改成名称
//从产品编号转变成产品名称
string MaterielID = e.Row.Cells[2].Text;//产品编号
TbProductInfo model = TbproductBLL.GetModels(MaterielID);
e.Row.Cells[2].Text = model.strName;
#endregion
}
}