#region 行绑定事件
/// <summary>
/// 行绑定事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string keyCode = e.Row.Cells[0].Text;//得到当前行的主键值
((LinkButton)(e.Row.Cells[14].Controls[1])).Attributes.Add("OnClick", "win=window.showModalDialog('EditAlarm.aspx?code="+keyCode+"','open','center:yes;scroll:yes;dialogWidth:400px;dialogHeight:580px;resizable:yes;');");
//双击事件
e.Row.Attributes.Add("OnDblClick", "if(this.backgroundColor!='#ffccaa'){this.style.backgroundColor='#ffccaa';win=window.showModalDialog('tbAlarmWeightImage.aspx?KeyCode=" + keyCode + "','open','center:yes;scroll:yes;dialogWeight:480px;dialogHeight:550px;resizable:yes;');return false};if(this.backgroundColor='#ffccaa'){this.backgroundColor='#ffffff';}");
//添加单击事件并设置延迟事件
e.Row.Attributes["onclick"] = String.Format("javascript:setTimeout(\"if(dbl_click){{dbl_click=false;}}else{{{0}}};\", 200);", ClientScript.GetPostBackEventReference(gridview, "Select$" + e.Row.RowIndex.ToString(), true));
}
}
#endregion