473,394 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 3403
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.Click, AddressOf myLinkButton_Click

--

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.Attributes.item("OnClick") = "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
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...
2
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): ...
0
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...
3
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...
13
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...
3
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...
0
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...
3
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...
0
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...
5
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.