R
Rami Cohen
Hi
I am creating a custom button control, inheriting from
System.Web.UI.WebControls.Button. I need to add client-side script to the
onclick event.
The problem is that the onclick attribute is generated by the Button base
class if validation is enabled. If I override the AddAttributesToRender
method and call base.AddAttributesToRender(), the base class renders all the
button attributes, including the onclick event with the client side
validation script. If I don't call it, I have to call writer.AddAttribute
for each and every base class attribute.
I tried adding my onclick attribute using this.Attributes.Add("onclick",
"bla();"). This is not good enough because the base class adds my code
before the validation code, and I need it to be reversed.
Any suggestions?
Thanks
Rami
I am creating a custom button control, inheriting from
System.Web.UI.WebControls.Button. I need to add client-side script to the
onclick event.
The problem is that the onclick attribute is generated by the Button base
class if validation is enabled. If I override the AddAttributesToRender
method and call base.AddAttributesToRender(), the base class renders all the
button attributes, including the onclick event with the client side
validation script. If I don't call it, I have to call writer.AddAttribute
for each and every base class attribute.
I tried adding my onclick attribute using this.Attributes.Add("onclick",
"bla();"). This is not good enough because the base class adds my code
before the validation code, and I need it to be reversed.
Any suggestions?
Thanks
Rami