Using OnClick of an asp:LinkButton

94 views Asked by At

I'm trying to use the OnClick event of an <asp:LinkButton> with a Sub that's defined between <script>tags (runat="server") and the code is never called. The code is designed to insert records in a database and is used elsewhere and is working. The Sub doesn't seems to be the problem.

It would seem that the OnClick never fires my Sub.

In an effort to be as descriptive as possible, the code is accessible.

1

There are 1 answers

0
Maude Boivin On

Well,

I figured it out... The PostBackUrl took precedence over the OnClick method... I had thought of saving the destination website in the PostBackUrl to do a Response.Redirect in the MyOnClick method but it was never called...

I corrected the problem using CommandArgument to store the destination and all is fine now...

I learned !

Thanks !

Maude