473,569 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Con trols.Add(l)
AddHandler l.Click, AddressOf l_Click
Next
End Sub

Public Sub l_Click(ByVal Sender As Object, ByVal E As
System.EventArg s)
Response.Write( "Button Clicked")
End Sub
Nov 18 '05 #1
1 2269
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******@lbrsp ec.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.Con trols.Add(l)
AddHandler l.Click, AddressOf l_Click
Next
End Sub

Public Sub l_Click(ByVal Sender As Object, ByVal E As
System.EventArg s)
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
7896
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 header of the datagrid in the "ItemDataBound" method of the grid. However, once, they are added in the grid, i seem to lose the event handler for the...
6
2905
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 that sets the properties send/passed from the main windows form. I'm having problems with the class library, the button control collection and my...
1
447
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 links in the page load so the click event will be recogonized. This works! Now the link previously clicked actually will generate a new list of...
3
1848
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 LiteralControl Dim lbtnCtrl As New LinkButton ltrCtrl.Text = "<br>" lbtnCtrl.Text = "WE: " & dtrCal(10).ToString lbtnCtrl.ToolTip = dtrCal(10).ToString & "...
3
13730
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. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should...
2
2689
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 1 2 3 4 5 ... Next Last >> I have achieved the first/previous/next/last buttons quite easily as follows in the ASPX (1.1) page:
5
2409
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 Builing Dynamicly link buttons with url's works fine. The problem is when i click the buttons they First link button and second link button works third...
5
1850
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 loaded on the .aspx PageLoad and the linkbuttons are created on the .ascx PageLoad. The problem I have is that those linkbuttons don't work on the...
9
11884
by: lilOlMe | last post by:
Hi there! I have generated a GridView that looks something like: SportName| CompanyNameX |CompanyNameY |CompanyNameZ Hockey.....| Shipping------------ |Accounting-------- |Shipping------------ BaseBall...| Receiving-----------|Shipping------------|Accounting--------- Etc............| Accounting----------|Receiving----------...
2
4438
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 schedule times if the user has permissions to edit schedules. When the user is not editing, or the user is not allowed to edit, the buttons that let the...
0
7700
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...
0
7614
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...
0
7974
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...
0
5219
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...
0
3653
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...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
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
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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...

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.