Connecting Tech Pros Worldwide Forums | Help | Site Map

onClcik with IF Condition

RA
Guest
 
Posts: n/a
#1: Nov 18 '05
Is it possible to add an attribute for onClick event with an if condition.
For example. If button is enabled then popup a message "Button Enabled" and
if it is disabled popup message "Button disabled"?



Marina
Guest
 
Posts: n/a
#2: Nov 18 '05

re: onClcik with IF Condition


Yes, you can put any javascript code you want in there.
Or you can just a call a function that has already been defined, and let it
contain all your logic.

"RA" <rchaudhary-nospam@storis.com> wrote in message
news:uZlMGmpwEHA.3808@TK2MSFTNGP15.phx.gbl...[color=blue]
> Is it possible to add an attribute for onClick event with an if condition.
> For example. If button is enabled then popup a message "Button Enabled"[/color]
and[color=blue]
> if it is disabled popup message "Button disabled"?
>
>[/color]


Dan Nash
Guest
 
Posts: n/a
#3: Nov 18 '05

re: onClcik with IF Condition


RA,

As far as I know, if a button is not enabled, it can't be clicked, and
therefore nothing is fired, neither code-behind or otherwise.

Be intrigued to know if that's not the case though!

Cheers

dhnriverside

"RA" wrote:
[color=blue]
> Is it possible to add an attribute for onClick event with an if condition.
> For example. If button is enabled then popup a message "Button Enabled" and
> if it is disabled popup message "Button disabled"?
>
>
>[/color]
RA
Guest
 
Posts: n/a
#4: Nov 18 '05

re: onClcik with IF Condition


Yes, you are right.

button does not fire click event when it is disabled; but unfortunately
dynamically created Hyperlink does.

"Dan Nash" <dan@musoswire.co.uk> wrote in message
news:9463844B-7ABA-4C7A-8D2F-D1840840E157@microsoft.com...[color=blue]
> RA,
>
> As far as I know, if a button is not enabled, it can't be clicked, and
> therefore nothing is fired, neither code-behind or otherwise.
>
> Be intrigued to know if that's not the case though!
>
> Cheers
>
> dhnriverside
>
> "RA" wrote:
>[color=green]
>> Is it possible to add an attribute for onClick event with an if
>> condition.
>> For example. If button is enabled then popup a message "Button Enabled"
>> and
>> if it is disabled popup message "Button disabled"?
>>
>>
>>[/color][/color]


RA
Guest
 
Posts: n/a
#5: Nov 18 '05

re: onClcik with IF Condition


Currently I have following code for a hyperlink control which is added to a
TableCell.
HLink.Attributes.Add("onClick", _
"return confirm('Are you Sure you want to delete " & _
"selected items?');")

With this statement eventhough I disable the link and if it has been clciked
it shows above message.

Can you please help me build a statement which only shows this message when
the link is enabled.


"Marina" <someone@nospam.com> wrote in message
news:uFIIfwpwEHA.3144@TK2MSFTNGP15.phx.gbl...[color=blue]
> Yes, you can put any javascript code you want in there.
> Or you can just a call a function that has already been defined, and let
> it
> contain all your logic.
>
> "RA" <rchaudhary-nospam@storis.com> wrote in message
> news:uZlMGmpwEHA.3808@TK2MSFTNGP15.phx.gbl...[color=green]
>> Is it possible to add an attribute for onClick event with an if
>> condition.
>> For example. If button is enabled then popup a message "Button Enabled"[/color]
> and[color=green]
>> if it is disabled popup message "Button disabled"?
>>
>>[/color]
>
>[/color]


Closed Thread