Javascript IE11 gridview行数据绑定asp.net vb.net上的window.opener.ParmArray==null
主页Gridview 我有gridview在编辑项目图像按钮点击弹出窗口需要打开,根据弹出选择主页编辑行需要从选择更新。它在Chrome上工作正常,但在IE上不工作 下面是Gridview代码Javascript IE11 gridview行数据绑定asp.net vb.net上的window.opener.ParmArray==null,javascript,vb.net,rowdatabound,gridviewrow,Javascript,Vb.net,Rowdatabound,Gridviewrow,主页Gridview 我有gridview在编辑项目图像按钮点击弹出窗口需要打开,根据弹出选择主页编辑行需要从选择更新。它在Chrome上工作正常,但在IE上不工作 下面是Gridview代码 <asp:TemplateField HeaderText="Responsible" ItemStyle-Width="270"> <ItemTemplate>
<asp:TemplateField HeaderText="Responsible" ItemStyle-Width="270">
<ItemTemplate>
<asp:Label id="lblContainmentRespUserNmItem" runat="server" Text='<%#Eval("RespUserName")%>' ></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtContainmentRespUserId" runat="server" Text='<%#Eval("RespUserId")%>' Columns="10" onBlur="javascript:{this.value = this.value.toUpperCase();}"></asp:TextBox>
<%--<asp:ImageButton id="imgContainmentRespUserId" runat="server" ImageUrl="~/images/magnify.gif" CssClass="WEB_CONTROL" ImageAlign="Bottom"
AlternateText="Lookup" Visible="true" EnableViewState="true" CausesValidation="true"></asp:ImageButton>--%>
<asp:ImageButton id="imgContainmentRespUserId" runat="server" ImageUrl="~/images/magnify.gif" CssClass="WEB_CONTROL" ImageAlign="Bottom"
AlternateText="Lookup" CausesValidation="true"></asp:ImageButton>
<asp:Label id="lblContainmentEditRespUserNmItem" runat="server" Text='<%#Eval("RespUserName")%>' ></asp:Label>
</EditItemTemplate>
<ItemStyle Width="270px"></ItemStyle>
</asp:TemplateField>
我正在尝试调用ImageButton单击弹出窗口进行选择
Javascript函数
函数OpenLookupIn(LookupIndowName、LookupURL、ObjectToUpdate、FormFieldIndicator、SetFocusIndicator、AppendIndicator、AppendSeparator、ParentWindow、WindowFeatures、LookupType、CallBackFunction、CallBackFunctionParms)
{
//如果此页的现有查找窗口已打开,请将其关闭。
if(LookupWin!=null)
{
LookupWin.close();
}
//将相关参数注册到作为全局变量存储的数组中。
ParmArray=新数组();
ParmArray[0]=查找URL;
ParmArray[1]=查找类型;
ParmArray[2]=对象更新;
ParmArray[3]=附件指示器;
ParmArray[4]=附件分隔符;
ParmArray[5]=父窗口;
ParmArray[6]=FormFieldIndicator;
ParmArray[7]=设置聚焦指示器;
ParmArray[8]=调用函数;
ParmArray[9]=调用函数Parms;
ParmArray[10]=“”;//返回值(如果查找中有)。
LookupWin=window.open(LookupURL、lookupindowname、WindowFeatures、true);
//若缺少窗口句柄,则提醒可能打开弹出窗口阻止程序。
if(LookupWin==null)
{
警报('已禁用查找功能!!!\n请关闭此页面的所有弹出窗口阻止程序!!');
}
}
if(window.opener.ParmArray==null)
{提醒(“对不起,似乎有多个浏览器窗口实例处于打开状态。请关闭它们并再次单击放大镜图标。”);
window.close();
}
总是在IE上获取空值,但在chrome中这很好
window.opener.parmaray==null我找不到任何与
parmaray
相关的文档。你确定它应该被使用,并且它不仅仅是一个内部功能吗?使用ParmArray和相关功能更新内容我不确定它是否真的应该按照你的想法工作(它似乎是Chrome独有的)。创建变量并不意味着可以通过object.variableName
访问它。然而,实际上有一种(某种程度上)本地支持的方式来做你想做的事情。看看原型:
Protected Sub Gridview_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
If ((e.Row.RowState And DataControlRowState.Edit) > 0) Then
Dim lblCommEditRespUserNm As Label = DirectCast(e.Row.FindControl("lblCommEditRespUserNm"), Label)
Dim txtCommRespUserId As TextBox = DirectCast(e.Row.FindControl("txtCommRespUserId"), TextBox)
Dim imgCommRespUserId As ImageButton = DirectCast(e.Row.FindControl("imgCommRespUserId"), ImageButton)
If Not IsNothing(imgCommRespUserId) Then
imgCommRespUserId.Attributes("onclick") = CommonFunctions.CreateLookupHandlerScript("../Lookup.aspx?LookupID=1&Level=1", "", "ASSOCIATE", "ProcessReturnValue", _
"new Array(document.all.item('" + txtCommRespUserId.ClientID + "'),document.all.item('" + _
lblCommEditRespUserNm.ClientID + "'))") + ";event.returnValue=false;"
End If
End If
End If
End Sub
Private Shared Function CreateLookupHandlerScript( _
ByVal windowName As String, _
ByVal lookupUrl As String, _
ByVal pageObjectToUpdate As String, _
ByVal formFieldIndicator As Boolean, _
ByVal setFocusIndicator As Boolean, _
ByVal appendIndicator As Boolean, _
ByVal appendSeparatorCharacter As String, _
ByVal windowFeatures As String, _
ByVal appLookupType As String, _
ByVal callBackFunction As String, _
ByVal callBackFunctionParms As String _
) As String
Dim WinName As String
Dim PageObject As String
Dim WinFeatures As String
Dim CBFunction As String
Dim CBFunctionParms As String
' Throw Exception when required parameters not entered.
If lookupUrl = "" Then
Throw New ArgumentOutOfRangeException("lookupUrl")
End If
If formFieldIndicator And pageObjectToUpdate = "" Then
Throw New ArgumentOutOfRangeException("pageObjectToUpdate")
End If
If appendIndicator And appendSeparatorCharacter = "" Then
Throw New ArgumentOutOfRangeException("appendSeparatorCharacter")
End If
' Apply defaults.
If windowName = "" Then
WinName = "Lookup"
Else
WinName = windowName
End If
If pageObjectToUpdate = "" Then
PageObject = "null"
Else
PageObject = pageObjectToUpdate
End If
If windowFeatures = "" Then
WinFeatures = "StandardLookupChrome+',status=yes,resizable=yes,scrollbars=yes,height=600,width=800'"
Else
WinFeatures = windowFeatures
End If
If callBackFunction = "" Then
CBFunction = "null"
Else
CBFunction = callBackFunction
End If
If callBackFunctionParms = "" Then
CBFunctionParms = "null"
Else
CBFunctionParms = callBackFunctionParms
End If
Return String.Format("OpenLookupWin('{0}','{1}',{2},{3},{4},{5},'{6}',window,{7},'{8}',{9},{10});", _
WinName, lookupUrl, PageObject, _
formFieldIndicator.ToString.ToLower, setFocusIndicator.ToString.ToLower, appendIndicator.ToString.ToLower, _
appendSeparatorCharacter, WinFeatures, appLookupType, CBFunction, CBFunctionParms)
End Function
function OpenLookupWin(LookupWindowName,LookupURL,ObjectToUpdate,FormFieldIndicator,SetFocusIndicator,AppendIndicator,AppendSeparator,ParentWindow,WindowFeatures,LookupType,CallBackFunction,CallBackFunctionParms)
{
// If an existing Lookup Window for this page is open, close it.
if (LookupWin != null)
{
LookupWin.close();
}
// Register related parameters into an array stored as a global variable.
ParmArray = new Array();
ParmArray[0]=LookupURL;
ParmArray[1]=LookupType;
ParmArray[2]=ObjectToUpdate;
ParmArray[3]=AppendIndicator;
ParmArray[4]=AppendSeparator;
ParmArray[5]=ParentWindow;
ParmArray[6]=FormFieldIndicator;
ParmArray[7]=SetFocusIndicator;
ParmArray[8]=CallBackFunction;
ParmArray[9]=CallBackFunctionParms;
ParmArray[10]=""; //ReturnValue, if any from the lookup.
LookupWin = window.open(LookupURL,LookupWindowName,WindowFeatures,true);
// If window handle is missing, alert to possiblity of popup blocker being turned on.
if (LookupWin == null)
{
alert('Lookup functionality disabled!!!\nPlease turn off all popup blockers for this page!!');
}
}
if (window.opener.ParmArray == null)
{ alert("Sorry, It seems there are multiple instances of browser window open. Please close them and click on the magnifying glass icon again.");
window.close();
}
</script>