By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,688 Members | 1,233 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,688 IT Pros & Developers. It's quick & easy.

multiple attributes.add on a link button

P: n/a
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attributes.Add("onClick", "MyFunction1();")
linkbutton.Attributes.Add("onClick", "MyFunction2();")

How would i get this to work? (keeping in mind that I cannot combine
MyFunction1 and 2 together) Is there another event other than onclick I can
use?

Thanks in advance.
Jul 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

Call one function after the other in a single event invocation itself as in:

linkbutton.Attributes.Add ("onClick", "MyFunction1(); MyFunction2();")

"rufus" <ru***@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attributes.Add("onClick", "MyFunction1();")
linkbutton.Attributes.Add("onClick", "MyFunction2();")

How would i get this to work? (keeping in mind that I cannot combine
MyFunction1 and 2 together) Is there another event other than onclick I can
use?

Thanks in advance.
Jul 21 '05 #2

P: n/a
Thanks for your reply.

The problem I have is that I am conditionally adding these attributes and
sometimes only MyFunction1() OR MyFunction2() OR both together are needed.
This could get complicated so I was looking for some alternative that would
allow me to add both separately.

"Shiva" wrote:
Hi,

Call one function after the other in a single event invocation itself as in:

linkbutton.Attributes.Add ("onClick", "MyFunction1(); MyFunction2();")

"rufus" <ru***@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attributes.Add("onClick", "MyFunction1();")
linkbutton.Attributes.Add("onClick", "MyFunction2();")

How would i get this to work? (keeping in mind that I cannot combine
MyFunction1 and 2 together) Is there another event other than onclick I can
use?

Thanks in advance.

Jul 21 '05 #3

P: n/a
You can always append further function names as in:

linkbutton.Attributes.Add ("onClick", "MyFunction1();")
If (...) Then
linkbutton.Attributes.Item ("onClick") &= ";MyFunction2();"
End If

If the specified key doesn't exist in Item collection, Nothing will be
returned.

"rufus" <ru***@discussions.microsoft.com> wrote in message
news:E6**********************************@microsof t.com...
Thanks for your reply.

The problem I have is that I am conditionally adding these attributes and
sometimes only MyFunction1() OR MyFunction2() OR both together are needed.
This could get complicated so I was looking for some alternative that would
allow me to add both separately.

"Shiva" wrote:
Hi,

Call one function after the other in a single event invocation itself as in:
linkbutton.Attributes.Add ("onClick", "MyFunction1(); MyFunction2();")

"rufus" <ru***@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attributes.Add("onClick", "MyFunction1();")
linkbutton.Attributes.Add("onClick", "MyFunction2();")

How would i get this to work? (keeping in mind that I cannot combine
MyFunction1 and 2 together) Is there another event other than onclick I can use?

Thanks in advance.

Jul 21 '05 #4

P: n/a


"Shiva" wrote:
You can always append further function names as in:

linkbutton.Attributes.Add ("onClick", "MyFunction1();")
If (...) Then
linkbutton.Attributes.Item ("onClick") &= ";MyFunction2();"
End If

If the specified key doesn't exist in Item collection, Nothing will be
returned.

Exactly what I was looking for. Thanks!
Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.