有关GridView在线等待
- C# code
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow ) { Label lb=e.Row.FindControl("lbName") as Label; e.Row.Cells[1].Attributes.Add("onclick ", " window.returnValue='" + lb.Text.Trim() + "';window.close();"); } }protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; bind(); }- JScript code
<script type="text/javascript"> function chose() { var hdc = window.showModalDialog("bunit.aspx", "newwindow", "resizable:no;scroll:yes;status:no;dialogLeft=380px;dialogTop=500px;dialogWidth=300px;dialogHeight=250px;center=no;help=no"); document.getElementById("<%=GridView1.ClientID%>").rows[document.getElementById("<%=GridView1.ClientID%>").rows.length - 1].getElementsByTagName("input")[3].value = hdc; }一个父窗口,点击某个按钮之后弹出子窗口,子窗口用Gridview绑定的数据,回传值这些没问题,现在存在这样一个问题,当弹出子窗口之后,点击编辑会出错
[解决办法]
- C# code
if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex==-1)