I'm using the Infragistics UltraWebTab(v1.0.6007.21) in an ASP.NET
application the tab control uses IFrame for each tab. My requirement is that
during transitions between tabs that if there are changes to the form that I
reconcile the changes to my dataset. I have no problem testing for changes
or pushing the changes back to the dataset. I'm using a combination of
techniques to try and trap the event andd meet the requirement. If the page
posts back I intercept the post back and disconnect the unload event handler
as well as when the form is posted. When the the window.unload fires if the
page is not posting back or the form is not bieng submitted I would expect
that the unloadSave function would be called. Here's the relevant client
code I'm using.
<SCRIPT event="oncontextmenu" for="document" language="JavaScript">
window.event.returnValue = false;
</SCRIPT>
<script language="JavaScript">
if (document.all) {
document.onkeydown = function () {
var key_f5 = 116; // 116 = F5
if (key_f5==event.keyCode) {
event.keyCode=0;
}
}
}
</script>
<script language="JavaScript">
var oldPostBack
function window.onload() {
oldPostBack = __doPostBack;
__doPostBack = MyPostBack;
}
function MyPostBack(Param1, Param2) {
if (typeof(oldPostBack) == 'function') {
formSubmitting();
oldPostBack(Param1, Param2);
}
}
function unloadSave() {
if (document.all('hdnSave') == !null) {
document.all('hdnSave').value = 'TRUE';
document.Form1.submit();
}
}
function unloadBeforeSave() {
if (document.all('hdnSave') == !null) {
if (document.all('hdnSave').value == 'SUBMITTING') {
window.onunload = null;
}
}
}
window.onblur = unloadSave;
window.onbeforeunload = unloadBeforeSave;
function formSubmitting() {
document.all('hdnSave').value = 'SUBMITTING';
}
</script>
</HEAD>
<BODY bgColor="bisque" MS_POSITIONING="GridLayout">
<FORM onsubmit="formSubmitting();" id="Form1"
encType="multipart/form-data" method="post" runat="server">
It's not and I can't figure out why.. In the main(parent) page containing
the tab control I also have a tab_onclick event that runs on the server
where I'm loading the previous tab.
Private Sub tabCallSheet_TabClick(ByVal sender As System.Object, ByVal e As
Infragistics.WebUI.UltraWebTab.WebTabEvent) Handles tabCallSheet.TabClick
LoadCallSheetTab(Convert.ToInt32(e.Tab.ContentPane.ID.Split("_"c)(1)))
End Sub
'Pass values to pages that make up the tabs
Private Sub LoadCallSheetTab(ByVal intNextTab As Integer)
Dim intPrevTab As Integer
If Not Session("LoadedTab") Is Nothing Then
With tabCallSheet.Tabs
.GetTab(Convert.ToInt32(Session("LoadedTab"))).ContentPane.TargetUrl =
"blank.htm"
End With
End If
With tabCallSheet.Tabs
.GetTab(intNextTab).ContentPane.TargetUrl = aryTabPages(intNextTab)
End With
Session("LoadedTab") = intNextTab
End Sub
The unload isn't bieng fired during page transitions.... I cannot figure out
for the life of me why... Hopefully someone who knows more than I do can
help.... Please.............??
If you need more information or code please let me know...