在C#父窗口後台的 gridView事件 RowDataBound用到了 e.Row.Attributes.Add方法(不采用LinkButton等方法,因為想用ondblclick GridView方法)調用前台showModalDialog方法顯示子窗口,無奈子窗口關閉時不會刷新父窗口的情況,紅色字體為解決的語句,具體實現如下:
父窗口後台代碼:
protected void gridview_RowDataBound(object sender, GridViewRowEventArgs e)
{
string l_stroderNo = "";
if (e.Row.RowIndex >= 0)
{
l_stroderNo= e.Row.Cells[1].Text;
e.Row.Attributes.Add("ondblclick", "return ShowDialog('Order.aspx?Operate=ReadOnly" + "&OrderNo=" + l_stroderNo + "');");
}
}
父窗口前台代碼:
function ShowDialog(Url)
{
var winStyle = "dialogwidth=840px;dialogheight=670px;help=no;scroll=no;status=no;close=no";
var result=showModalDialog("Frame.aspx?"+Url,null,winStyle)
if(result != null && result == "ok")
{
//刷新父窗口
window.location.href=document.location.href;
return true;
}
else
return false;
}