I have have an asp.net check box with autopostback set to true inside an update panel. When I check the check box it shows the other controls that I want to show. When I un-check the check box a value in the database is updated. This is all working fine.
If I want to move to another page after un-checking the check box a dialog which is asking whether I want to stay on this page or leave the page is displayed. How can I stop that dialog box from appearing?
<asp:UpdatePanel runat="server" ID="upOnProbation" UpdateMode="Conditional">
<ContentTemplate>
<div>
<table>
<tr>
<td>
<asp:CheckBox runat="server" Text="On Probation" ID="chkOnProbation" AutoPostBack="true" ClientIDMode="AutoID" />
</td>
</tr>
<asp:PlaceHolder runat="server" ID="plcProbabtionDates" Visible="false">
<tr>
<td>
Start date
</td>
<td>
<ComponentArt:Calendar runat="server" ID="dtStart" ControlType="Picker" PickerFormat="Short">
</ComponentArt:Calendar>
</td>
</tr>
<tr>
<td>
End date
</td>
<td>
<ComponentArt:Calendar runat="server" ID="dtEnd" ControlType="Picker" PickerFormat="Short">
</ComponentArt:Calendar>
</td>
</tr>
<tr>
<td>
<asp:Button runat="server" ID="btnSave" Text="Save" CssClass="btn" />
</td>
</tr>
</asp:PlaceHolder>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Protected Sub chkOnProbation_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkOnProbation.CheckedChanged
If chkOnProbation.Checked Then
plcProbabtionDates.Visible = True
dtStart.SelectedDate = DateTime.Now
dtEnd.SelectedDate = DateTime.Now.AddMonths(6)
Else
plcProbabtionDates.Visible = False
objCompany.On_Probation = False
objCompany.Save(UserStaffID)
End If
End Sub