我想将值从子窗口传递到父窗口,我通过会话传递值,但显然它不会在没有任何回发事件的父窗口上更新。我需要帮助如何在子弹出关闭后立即将值设置为文本框
父窗口代码
Protected Sub ImageButton1_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton1.Click
Session("lookup") = txtpartname.Text
Dim javaScript As String = String.Format("winRef = window.open('lookup.aspx', 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=Yes,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No'); winRef.focus();")
ScriptManager.RegisterStartupScript(Me, GetType(String), "OpenWindowScript", javaScript, True)
End Sub
Protected Sub save_new_Click(sender As Object, e As EventArgs) Handles save_new.Click
If (Session("partname") <> Nothing) Then
txtpartname.Text = Session("partname")
End If
Dim ErrorCheck As Integer = Functions.CreateComplainEstimate(ReturnVal, LabelRecordType.Text, , TxtActualAmount.Text, txtTotalAmountDiscounted.Text, txtDiscount.Text, txtDiscountRate.Text, txtQuantity.Text, txtIRNumber.Text, txtpartIssuedDateTime.Text, txtpartReturnedDateTime.Text, txtcollectionfromfranchiseCWS.Text, txtPNADate.Text, txtIRNumberDateTime.Text, txtpaymenttofranchisecws.Text, CheckBoxValue(checkPartIssued), CheckBoxValue(checkPartNotArranged), CheckBoxValue(checkPartReceived), CheckBoxValue(checkPartReturned), CheckBoxValue(checkPNA), CheckBoxValue(checkWrongDebrief), CheckBoxValue(checkIncludeInEstimate), CheckBoxValue(checkIncludeInDebriefing), txtCompany.Text, txtDebreifingIn.Text, LabelBilingtype.Text, txtDiscountStatus.Text, txtConsumptionType.Text, txtpartname.Text)
Session.Remove("partname")
If ErrorCheck = 100 Then
Session("incident") = ReturnVal
Response.Redirect("Debriefing.aspx")
Else
ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "alertMessage", "alert('Error Saving Inspection Fault!')", True)
End If
End Sub
子窗口
Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
' Response.Cookies("ID").Value = GridView1.SelectedRow.Cells(2).Text.ToString()
Session("partname") = GridView1.SelectedRow.Cells(2).Text.ToString()
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "CloseWindowScript", "window.close();", True)
End Sub