A
Adrian
I appear to be losing ViewState information when calling the
__doPostBack function.
I am attempting to use the showModalDialog to load a new web page
which confirms that a user wishes to save a query.
The showModalDailog returns a value to the original page which is used
as a parameter in __doPostback, in turn trapped by the Page_Load
procedure and processed.
This all seems to work with the exception that I appear to be losing
state information on all the page controls as if I had refreshed the
page.
Any help or pointers would be greatly appreciated, below is the main
parts of the code. If I comment out the __doPostback state
information is not lost.
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
If qryFields.SaveQueryExists() Then
PopupWindowConfirmSave()
Else
qryFields.Save()
End If
End Sub
' --------------------------------------
Private Sub PopupWindowConfirmSave()
Dim jscript As System.Text.StringBuilder = New
System.Text.StringBuilder()
jscript.Append("<script language=""Javascript"">")
jscript.Append("OpenChild();")
jscript.Append("</script>")
RegisterClientScriptBlock("popup", jscript.ToString)
End Sub
' ---------------------------------------
' Javascript Function - doesn't lose state information
' if the __doPostback is commented out
function OpenChild()
{
var WinSettings =
"center:yes;resizable:no;dialogHeight:150px;dialogWidth:350px;status:no"
var RetVal = window.showModalDialog("Confirmation.htm","",
WinSettings);
if (RetVal == null)
{
window.alert("Save cancelled")
}
else
{
if (RetVal = "YES")
{
__doPostBack('','@Custom1')
}
else
{
__doPostBack('','@Custom2')
}
}
}
__doPostBack function.
I am attempting to use the showModalDialog to load a new web page
which confirms that a user wishes to save a query.
The showModalDailog returns a value to the original page which is used
as a parameter in __doPostback, in turn trapped by the Page_Load
procedure and processed.
This all seems to work with the exception that I appear to be losing
state information on all the page controls as if I had refreshed the
page.
Any help or pointers would be greatly appreciated, below is the main
parts of the code. If I comment out the __doPostback state
information is not lost.
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
If qryFields.SaveQueryExists() Then
PopupWindowConfirmSave()
Else
qryFields.Save()
End If
End Sub
' --------------------------------------
Private Sub PopupWindowConfirmSave()
Dim jscript As System.Text.StringBuilder = New
System.Text.StringBuilder()
jscript.Append("<script language=""Javascript"">")
jscript.Append("OpenChild();")
jscript.Append("</script>")
RegisterClientScriptBlock("popup", jscript.ToString)
End Sub
' ---------------------------------------
' Javascript Function - doesn't lose state information
' if the __doPostback is commented out
function OpenChild()
{
var WinSettings =
"center:yes;resizable:no;dialogHeight:150px;dialogWidth:350px;status:no"
var RetVal = window.showModalDialog("Confirmation.htm","",
WinSettings);
if (RetVal == null)
{
window.alert("Save cancelled")
}
else
{
if (RetVal = "YES")
{
__doPostBack('','@Custom1')
}
else
{
__doPostBack('','@Custom2')
}
}
}