473,883 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LinkButton

Hi,
I create a LinkButton in runtime, and I want to be able to
access a function when a user clicks on the generated link
in the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?
Nov 17 '05 #1
4 3435
Hugo Flores wrote:
Hi,
I create a LinkButton in runtime, and I want to be able to
access a function when a user clicks on the generated link
in the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?


AddHandler myLinkButton.Cl ick, AddressOf myLinkButton_Cl ick

--

Jos Branders
Nov 17 '05 #2
After you create the object at runtime, use the AddHandler command.

AddHandler Button1.Click, AddressOf Button1_Click
Hope this helps,

Jurjen de Groot
G.I.T.S. Netherlands
"Hugo Flores" <hu*********@ge .com> wrote in message
news:01******** *************** *****@phx.gbl.. .
Hi,
I create a LinkButton in runtime, and I want to be able to
access a function when a user clicks on the generated link
in the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?

Nov 17 '05 #3
Thenk you both for your answer
-----Original Message-----
Hi,
I create a LinkButton in runtime, and I want to be able toaccess a function when a user clicks on the generated linkin the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?
.

Nov 17 '05 #4
As Jurjen pointed out, ADD HANDLER works,
OR - Create a page-level WITHEVENTS variable

in either case, be sure the dynamic control is created on all post-back
operations. If you don't, the event won't be trapped.

If you are referring to client-side (java script):

MyControl.Attri butes.item("OnC lick") = "return MyFunction();"

G.L.
"Hugo Flores" <hu*********@ge .com> wrote in message
news:01******** *************** *****@phx.gbl.. .
Hi,
I create a LinkButton in runtime, and I want to be able to
access a function when a user clicks on the generated link
in the page.
My problem is that I don't know how to asociate the
function to the link in runtime.

Any one knows this?

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3753
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the following code fragments in which I want to list through all files on a directory with a link to download each file by passing a filename and whether or not to force the download dialog box to appear.
2
2203
by: News | last post by:
Hi, I need help with datalist and linkbutton. I need a LinkButton to display in datalist if datafield "is_measure_customchecklist" in a db table set to true. Here is the code (in parts): <asp:DataList id="dtl1" runat="server"
0
1319
by: Solomon Shaffer | last post by:
This is very interesting - and odd. I have a number of LinkButtons that are created in a custom data grid that I created. The purpose of the LinkButtons is to provide alphabetical filtering functionality on the grid. Therefore, a LinkButton is added for every letter of the alphabet. I also have a numeric filter button and an "All" button that removes the filter. All of the LinkButtons are wired up to the same event called...
3
4078
by: MRW | last post by:
I have a simple linkbutton and a function when it's clicked. It works perfectly in a regular .aspx page. However, when I place it inside the ContentPlaceHolder, it no longer works. It does *something*, but certainly not the function, which is also in the ContentPlaceHolder. This is also true concerning any events in there. Any ideas? Thanks for any help!
13
10191
by: rn5a | last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to show him 5 LinkButtons (one for each order) so that when he clicks the first LinkButton, he would be shown the details of his first order. Likewise if he clicks the second LinkButton, he will be shown the details of the second order he had placed. The Text of the LinkButtons will be 1 2 3 etc. So this user would see 1 2 3 4 5 as the LinkButtons. The problem is...
3
2221
by: rn5a | last post by:
Consider the following code which creates LinkButtons dynamically: For i = 1 to 5 lnkBut = New LinkButton lnkBut.ID = "lnkBut" & i lnkBut.Text = i.ToString & " " lnkBut.CommandName = i pnlLinks.Controls.Add(lnkBut) Next
0
1914
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The table gets successfully displayed on the browser with the LinkButton. When I click on the link button in the browser, my control does not go inside the custom even that I wrote for the link button. I have a table control as ProviderTbl in which...
3
6093
by: =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= | last post by:
I have two sets of search criteria on my page. They are placed inside two DIV tags made visible/hidden by a client script. In each DIV tag I have a LinkButton that performs the search from each set. By using AJAX I get the resulting list expand and collapse without page reload. All work smoothly. But one user today complained that the submit behaviour doesn't work like before.
0
2049
by: HillBilly | last post by:
MasterPages again. Three LinkButtons are being used as styled tabs in the content page that will load a different ListView when a tab is selected: TabA, TabB or TabC. The LinkButtons are declared in the apsx and the LinkButtons are being found in their MasterPage container template(s). Enabling and disabling the SkinId and CssClass properties for each LinkButton is being handled in the PreInit of a GlobalBaseClass that inherits from...
5
13953
by: Peter Larsen [CPH] | last post by:
Hi, The following sample shows a LinkButton in the HeaderTemplate of a Repeater control. The problem is that i'm not able to access the linkbutton in code (in the cs file) as long as the linkbutton stays in the repeater control - see the following line: testLink.CommandArgument = "just testing"; or testLink.Text = "Some new text";
0
9940
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
10415
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7971
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7126
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
5797
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...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4611
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
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3232
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.