62,267
社区成员
发帖
与我相关
我的任务
分享
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex == -1) return;
string FreightId = ds.Tables["FreightExports"].Rows[e.Row.RowIndex][0].ToString();
//Session["FreightId"] = GridView1.DataKeys[e.Row.RowIndex].Value;//和上面代码效果一样
Session["FreightId"]=FreightId ;
if (e.Row.RowType == DataControlRowType.DataRow) //判断是否是DataRow,以防止鼠标经过Header也有效果
{
e.Row.Attributes.Add("onDblClick", "javascript:top.location.href='/FrmHYCK_Edit.aspx?FreightId=" + FreightId + "'");
e.Row.Attributes.Add("style", "cursor:hand");
e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#A095C4'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
e.Row.Cells[1].Attributes.Add("class", "text");
}
}
#region 添加点击事件
/// <summary>
/// 添加点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string aa = "window.returnValue = \"" + e.Row.Cells[0].Text + "\";window.close();";
e.Row.Attributes.Add("ondblclick", aa);
}
}
catch (Exception ex)
{
this.ShowMessage(ex.Message);
}
}
#endregion<script type="text/javascript" language="javascript">
function showwindow()
{
var returnValue = window.showModalDialog("DItemList.aspx",
'window','dialogWidth=650px;dialogHeight=420px;status=no');
document.getElementById ("txtItem_id").value = returnValue == null?document.getElementById ("txtItem_id").value:returnValue;
}
</script>