473,385 Members | 1,780 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,385 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 3402
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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:
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...
0
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,...

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.