0

Mainpage Gridview

i have gridview on edit item image button click popup needs to be opened and based on popup selection home page edited row needs to be updated from selection.its working fine on Chrome but not on IE

here is the Gridview code

<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>

Gridview_RowDataBound

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

i am trying call on imagebuttonclick popup window for selection

Javascript 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>

Getting Null value always on IE but in chrome its fine window.opener.ParmArray == null

kumarjcet
  • 419
  • 1
  • 5
  • 8
  • 1
    I can't find any documentation related to `ParmArray`. Are you sure it's supposed to be used and that it isn't just an internal feature? – Visual Vincent Apr 25 '18 at 09:27
  • updated content with ParmArray and dependent functions – kumarjcet Apr 25 '18 at 09:44
  • I'm not sure it is actually supposed to work the way you think (it appears to be exclusive to Chrome). Just because you create a variable that doesn't mean you can access it via `object.variableName`. However there is actually a (somewhat) natively supported way to do what you want. Have a look at prototypes: https://www.w3schools.com/js/js_object_prototypes.asp – Visual Vincent Apr 25 '18 at 16:01

0 Answers0