473,654 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple attributes.add on a link button

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

In other words:

linkbutton.Attr ibutes.Add("onC lick", "MyFunction1(); ")
linkbutton.Attr ibutes.Add("onC lick", "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
4 12622
Hi,

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

linkbutton.Attr ibutes.Add ("onClick", "MyFunction 1(); MyFunction2();" )

"rufus" <ru***@discussi ons.microsoft.c om> wrote in message
news:AC******** *************** ***********@mic rosoft.com...
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attr ibutes.Add("onC lick", "MyFunction1(); ")
linkbutton.Attr ibutes.Add("onC lick", "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
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.Attr ibutes.Add ("onClick", "MyFunction 1(); MyFunction2();" )

"rufus" <ru***@discussi ons.microsoft.c om> wrote in message
news:AC******** *************** ***********@mic rosoft.com...
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attr ibutes.Add("onC lick", "MyFunction1(); ")
linkbutton.Attr ibutes.Add("onC lick", "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
You can always append further function names as in:

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

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

"rufus" <ru***@discussi ons.microsoft.c om> wrote in message
news:E6******** *************** ***********@mic rosoft.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.Attr ibutes.Add ("onClick", "MyFunction 1(); MyFunction2();" )

"rufus" <ru***@discussi ons.microsoft.c om> wrote in message
news:AC******** *************** ***********@mic rosoft.com...
I want to add 2 'onclick' events to a link button but, of course, the
javascript wont work.

In other words:

linkbutton.Attr ibutes.Add("onC lick", "MyFunction1(); ")
linkbutton.Attr ibutes.Add("onC lick", "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


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

linkbutton.Attr ibutes.Add ("onClick", "MyFunction1(); ")
If (...) Then
linkbutton.Attr ibutes.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3593
by: rachel | last post by:
Hi all, I am new in ASP.Net. I have a question on link multiple web forms together. Here is the scenario: I create an Index.aspx WebForm which consists of a banner and three navigator buttons as well as a body to load the content. It is exactly like a normal HTML page where there are banner, menu bar, and body to load content. In my case, there are three .aspx WebForms which I have to link them together in the Index.aspx page. So that...
3
2559
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: http://www.drpt.virginia.gov/temp1.gif All the fields on this form have validation controls on them so they can not submit the form unless all fields are completed and some fall within a specified numeric range. When the form first is loaded,...
6
2402
by: Shashi | last post by:
I have developed ASP.Net application using .Net 1.1 Framework. When the user clicks image file through Java script I am using my search window as below. QueryString = "frmMySearchWebForm.aspx?DOBDate=" + txtDOBDt popUp =window.open(QueryString,null, "height=50,width=80,status=no,left =0,top =0,toolbar=no,menubar=no,location=no,scrollbars =yes"); When the user picks a certain customer in the frmMySearchWebForm I am
3
13095
by: Mark | last post by:
This is a solution... Often users want to keep clicking "submit" when they are waiting for server processing. Most apps these days like to disable the submit button to prevent this. You can't just disable the button in the OnClick event in ASP.Net because then the Click event won't post to the server (because you disabled it). I searched google groups, and there is a solution to this problem, but I didn't think it was clean enough and...
1
3887
by: Bruce | last post by:
I use btnSave.Attributes.Add("onclick", "ShowMessage()") to link my web control button to a JavaScript function. It works well until I added a Validation control into the page. After that, even the all of the validations passed, my ShowMessage() still does not get triggered. When checking the view source carefully, I found that the btnSave button have 2 onClick events defined in the tag.
4
2654
by: rufus | last post by:
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
3
6449
by: mrsd2c | last post by:
I am building custom attributes as a means to pass data from the client to the server. To accomplish this task, a class of "postback" is applied to a link or button. When the link or button is clicked, custom attributes are parsed from the link and submitted to the application as hidden form fields. The code below better illustrates the HTML: <a class="postback" c:myAttribute1="value" c:myAttribute2="value">submit</a>
6
3497
by: Homer J. Simpson | last post by:
Hi all, I have enough experience with HTML/classic ASP to get by, and I'm trying to learn ASP.NET. Traditionally, I've taken the habit of breaking out extra-long CSS files into multiple, smaller ones, and referring to them in my HTML/ASP files on an as-needed basis. Essentially, I've organized things as: /default.asp
1
2733
by: =?Utf-8?B?UmFqYWdvcGFs?= | last post by:
Question How to Upload multiple images in asp.net? (ex.Like a gmail file field)
0
8379
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.