W
Wayne Sepega
I have inherited from System.Web.UI.WebControls and overrode the OnRender of
my new button. In the on render I generate some JavaScript and add it as an
attribute as follows:
this.Attributes.Add("onclick", javascript);
I have the following issues:
1) I have to add to the javascript the following:
this.Page.ClientScript.GetPostBackEventReference(this, null);
When added, this causes the post back to fire even if the client
validation fails. Also the javascript gets both the page reference I added
as well as the PostBackWithOptions.
2) Don't add in GetPostBackEventRefernce
A page with no validation doesn't have the call to the post back,
but if there is client validation then the post back with options gets
generated.
The above issues occur even if I add the javascript to the OnClientClick
event.
I'm fairly new to writing ASP.net controls, so if I am putting/generating
the javascript in the wrong place or missing something obvious please let me
know.
Thanks
Wayne
my new button. In the on render I generate some JavaScript and add it as an
attribute as follows:
this.Attributes.Add("onclick", javascript);
I have the following issues:
1) I have to add to the javascript the following:
this.Page.ClientScript.GetPostBackEventReference(this, null);
When added, this causes the post back to fire even if the client
validation fails. Also the javascript gets both the page reference I added
as well as the PostBackWithOptions.
2) Don't add in GetPostBackEventRefernce
A page with no validation doesn't have the call to the post back,
but if there is client validation then the post back with options gets
generated.
The above issues occur even if I add the javascript to the OnClientClick
event.
I'm fairly new to writing ASP.net controls, so if I am putting/generating
the javascript in the wrong place or missing something obvious please let me
know.
Thanks
Wayne