Re: HTML Button Not Submitting Page
From: bruce barker (nospam_brubar_at_safeco.com)
Date: 03/11/04
- Next message: RA: "Re: Which size font to use?"
- Previous message: Bob Franklin: "Re: ASP SITE with SQL Server--best way to backup?"
- In reply to: Alphonse Giambrone: "HTML Button Not Submitting Page"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 11 Mar 2004 10:49:32 -0800
you confirm delete code has to support validation and postback itself.
btnDelete.Attributes.Add("onclick", string.Format("return
ConfirmDelete('{0}');",btnDelete.UniqueId)
function ConfirmDelete(id)
{
if (window.confirm("really?")
&& (typeof(Page_ClientValidate) != 'function' || Page_ClientValidate())
{
__doPostBack(id,'');
}
if (document.all) event.returnValue = false; // hack for ie bug
return false;
}
-- bruce (sqlwork.com)
"Alphonse Giambrone" <NOSPAMa-giam@example.invalid> wrote in message
news:uhy4DN4BEHA.2804@tk2msftngp13.phx.gbl...
> Thanks to info from Steven Cheng I am able to use an HTML button on my
aspx
> page in order to wrap text in it.
> I am using it to delete a record in a database and it works.
> My only problem is that I want to include javascript to confirm the
deletion
> before submitting.
> I have a javascript function that prompt for confirmation and returns
> true/false.
> For a regular server side button I add it as follows in the page load
event
> and it works fine:
>
> btnDelete.Attributes.Add("onclick", "return ConfirmDelete();")
>
> However if I add it the same way to the HTML button, the prompt works, but
> the page is not submitted.
> Looking at the source, this is what is rendered for the event with and
> without my added function:
>
> onclick="return ConfirmDelete(); {if (typeof(Page_ClientValidate) !=
> 'function' || Page_ClientValidate())
> __doPostBack('U_PageLinks1$btnDelete','')} "
>
> onclick="{if (typeof(Page_ClientValidate) != 'function' ||
> Page_ClientValidate()) __doPostBack('U_PageLinks1$btnDelete','')} "
>
> Any suggestion on how I can confirm the delete and still submit the page?
>
> TIA
>
> --
>
> Alphonse Giambrone
> Email: a-giam at customdatasolutions dot us
>
>
>
- Next message: RA: "Re: Which size font to use?"
- Previous message: Bob Franklin: "Re: ASP SITE with SQL Server--best way to backup?"
- In reply to: Alphonse Giambrone: "HTML Button Not Submitting Page"
- Messages sorted by: [ date ] [ thread ]