PC Review


Reply
Thread Tools Rate Thread

Distinguish Clicks Buttons

 
 
ruca
Guest
Posts: n/a
 
      30th Mar 2004
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


 
Reply With Quote
 
 
 
 
Eidolon
Guest
Posts: n/a
 
      30th Mar 2004
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
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Buttons not "hearing" the clicks K Viltersten Microsoft ASP .NET 1 15th May 2008 06:27 PM
Distinguish XPE from XP Pro todd.sowter-eds@eds.com Windows XP Embedded 1 22nd Jun 2005 03:25 AM
Single clicks detected as double clicks =?Utf-8?B?Umlzc2EgQW5u?= Windows XP Help 4 27th May 2005 10:01 PM
Why 2 Clicks To Use Buttons?? =?Utf-8?B?QUNhdW50ZXI=?= Microsoft ASP .NET 3 10th Jan 2005 09:39 PM
64 bit or 32 bit distinguish deepak vaswani Microsoft Windows 2000 0 20th Aug 2003 06:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:28 AM.