Well, the attirbutes one is a client-side event. So what you could do is
have that one call a function which checks some client-side condition, and
if it is such-and-so, then do your processing and return false, else dont do
your processing, and return true.
eg:
<asp:button id=who runat=server onclick="javascript:return
myFunc();"></asp:button>
In the above button the onclick (added only for readability, you would
actually add it to the attribs like you are, the above wouldnt actually
work) calls the function myFunc. myFunc would check some checkbox, or text
value or whathave.. if it needs to run, then it would, and return false, if
it doesnt, then it simply returns true.
When an attribute "onclick" returns false, it prevents the form from posting
back, and the server-side _Click never happens.
Hope this helps.
"ruca" <(E-Mail Removed)> wrote in message
news:OImJ%23%(E-Mail Removed)...
> Can I distinguish between this two kinds of OnClick for Button Control:
>
> 1- btnPopup_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnPopup.Click
>
> 2- btnPopup.Attributes.Add("OnClick", "...") //here I have a javascript
> function that I want to use.
>
> I want to distinguish both and use one in some situations and the other in
> others situations.
> Can I do this in code?
>
>
> --
> Programming ASP.NET with VB.NET
> Thank's (if you try to help me)
> Hope this help you (if I try to help you)
> ruca
>
>
|