Отключить пост обратно из asp.net, т.е. кнопки, ссылки, изменение индекса страницы сетки, сортировку и т. Д., Когда пост уже выполняется. Целевой браузер - IE 6+. Я написал эти 2 javascript, я не уверен, как применять его при изменении индекса страницы GridView.
<script type="text/javascript">
//isFormSubmitted variable is used to prevent the form submission while the server execution is in progress
var isFormSubmitted = false;
//If the form is already submitted, this function will return false preventing the form submission again.
function SubmitForm(msg)
{
try {
if(isFormSubmitted == true)
{
alert('A post back is already in progress. Please wait');
return false;
}
else
{
var res = false;
if (msg)
{
res = confirm(msg);
}
if (res == true)
{
isFormSubmitted = true;
}
return res;
}
} catch(ex) {}
}
function VerifySubmit()
{
if(isFormSubmitted == true)
{
alert('A post back is already in progress. Please wait');
return false;
}
else
{
isFormSubmitted = true;
return true;
}
}
</script>
Для кнопок я могу прикрепить SubmitForm к OnClientClick следующим образом.
<asp:Button ID="btnCancel" runat="server" CssClass="button" Text="Cancel" OnClick="btnCancel_Click" OnClientClick="return SubmitForm('Do you want to continue with cancelling recent action?');" />
Но я не уверен, как подключить VerifySubmit к элементам управления без подсказок, таким как пейджер gridview.