We are using jQuery to identify if a form isDirty which works great except when there is a radComboBox that has a selectedIndexChanged and loadsOnDemand? When the user types something in the RadComboBox, jQuery sees the form as Dirty and when the user clicks cancel from the confirmation popup there is an error.
Is there a way to exclude the radComBox for the isDirty?
OR
Is there a way to stop the RadComboBox from postingBack to the OnSelectedIndexChanged if the user selects cancel from the confirmation popup?
Attached is the error and here are snippets of our code:
We are very new to the jQuery framework so any help very much appreciated.
Thanks in advance,
Gene.
Is there a way to exclude the radComBox for the isDirty?
OR
Is there a way to stop the RadComboBox from postingBack to the OnSelectedIndexChanged if the user selects cancel from the confirmation popup?
Attached is the error and here are snippets of our code:
<telerik:RadComboBox runat="server" ID="PermitRadComboBox" Height="190px" Width="250px" |
EmptyMessage="Type a code or name" MarkFirstMatch="true" EnableLoadOnDemand="true" |
HighlightTemplatedItems="true" OnClientItemsRequested="UpdateItemCountField" |
OnDataBound="PermitRadComboBox_DataBound" OnItemDataBound="PermitRadComboBox_ItemDataBound" |
OnItemsRequested="PermitRadComboBox_ItemsRequested" DropDownWidth="450px" AutoPostBack="True" |
CausesValidation="False" OnSelectedIndexChanged="PermitRadComboBox_SelectedIndexChanged"> |
<HeaderTemplate> |
<ul> |
<li class="col1">Number</li> |
<li class="col2">Permittee</li> |
</ul> |
</HeaderTemplate> |
<ItemTemplate> |
<ul> |
<li class="col1"> |
<%# DataBinder.Eval(Container.DataItem, "permit_number") %></li> |
<li class="col2"> |
<%# DataBinder.Eval(Container.DataItem, "permittee") %></li> |
</ul> |
</ItemTemplate> |
<FooterTemplate> |
A total of |
<asp:Literal runat="server" ID="RadComboItemsCount" /> |
items |
</FooterTemplate> |
</telerik:RadComboBox> |
<script type="text/javascript"> |
var isDirty = false; |
var msg = 'This page has unsaved changes.\n\nClick OK to abandon the changes and leave the page.\n\nClick Cancel to stay on the page so you can save your changes.'; |
$(document).ready(function () |
{ |
$(':input').change(function () |
{ |
if (!isDirty) |
{ |
isDirty = true; |
} |
}); |
window.onbeforeunload = function () |
{ |
if (isDirty) return msg; |
}; |
}); |
</script> |
We are very new to the jQuery framework so any help very much appreciated.
Thanks in advance,
Gene.