473,385 Members | 1,919 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.

Dynamic Link Buttons

This is the first time I have tried to create dynamic
controls. I am trying to create a hyperlink control.
The control will display properly but the event isn't
triggered.

I read a lot of stuff pertaining to this topic but have
not been able to figure out my problem. TEST() is
processed when I click a command button which creates the
dynamci link buttons. The dynamic link buttons display
fine but have no event when clicked.

Can someone please give a few suggestions.

Thanks

Private sub TEST()
'All variables have been declared. Left them out to save
'Room
l.Text = JobParsed
l.ID = 1
l.CommandName = "Link"
LinkControl.Controls.Add(l)
AddHandler l.Click, AddressOf l_Click
Next
End Sub

Public Sub l_Click(ByVal Sender As Object, ByVal E As
System.EventArgs)
Response.Write("Button Clicked")
End Sub
Nov 18 '05 #1
1 2239
I assume you are creating the controls on a button click. when the postback
from the hyperlink happens you need to recreate the controls (say in form
load) and reassign the handlers. you can save a flag to do this in viewstate
or a hidden field.

-- bruce (sqlwork.com)
"brian" <bs******@lbrspec.com> wrote in message
news:1a*****************************@phx.gbl...
This is the first time I have tried to create dynamic
controls. I am trying to create a hyperlink control.
The control will display properly but the event isn't
triggered.

I read a lot of stuff pertaining to this topic but have
not been able to figure out my problem. TEST() is
processed when I click a command button which creates the
dynamci link buttons. The dynamic link buttons display
fine but have no event when clicked.

Can someone please give a few suggestions.

Thanks

Private sub TEST()
'All variables have been declared. Left them out to save
'Room
l.Text = JobParsed
l.ID = 1
l.CommandName = "Link"
LinkControl.Controls.Add(l)
AddHandler l.Click, AddressOf l_Click
Next
End Sub

Public Sub l_Click(ByVal Sender As Object, ByVal E As
System.EventArgs)
Response.Write("Button Clicked")
End Sub

Nov 18 '05 #2

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
6
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library...
1
by: brian | last post by:
'visual studio 2002 pro 1.0 framwork' I am creating dynamic Link buttons on my intranet site and assigning a click_event to them. A user clicks a link and I call the method to recreate the...
3
by: WebBuilder451 | last post by:
I have a series of dynamic link buttons created based upon a datareader. I've added a click event and it calls the sub ok: example: "while loop through the reader" Dim ltrCtrl As New...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
2
by: WolfyUK | last post by:
Hello, I have a standard asp:DataGrid called CasesGrid that I wish to write my own paging controls for. The aim is to get something like the following rendered to screen: << First < Previous...
5
by: Matt | last post by:
Creating Dynamic aspnet link buttons with in user control, Then i use the control on ever page with wraped with master page. I get the url of the link buttons from xml. Parameter from xml also...
5
by: Gui | last post by:
Hi, I'm working in C# .net 2005 with Ajax. I have a page that loads dynamic user controls depending on the scenario. In those user controls, I create dynamic linkbuttons. The user controls are...
9
by: lilOlMe | last post by:
Hi there! I have generated a GridView that looks something like: SportName| CompanyNameX |CompanyNameY |CompanyNameZ Hockey.....| Shipping------------ |Accounting-------- |Shipping------------...
2
Frinavale
by: Frinavale | last post by:
I've created a ASP.NET control that displays a "book" of schedules. It dynamically displays scheduling times and allows the user to page through the schedules. It also lets the user edit 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:
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
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...
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:
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.