473,811 Members | 3,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LinkButton Event Handler in ASP.NET 2.0

Hello

I have very recently moved from VS2003/ASP.Net 1.1 to VS2005/ASP.Net 2.0.

I have made up a web page which has many labels, image buttons and link
buttons. I am have a lot of trouble writing an event handler for a particular
link button and I have no idea why.

This is exactly what I am doing, step by step:
1. Add a link button to the form using the designer. Set control name as
"lbYourFilesExp lained", and I set the text and class properties. I then press
save.
2. I then double-click on the control. This opens up the code view
The following code appears:

-------------------------------

Protected Sub lbYourFilesExpl ained_Click(ByV al sender As Object, ByVal e As
System.EventArg s) Handles lbYourFilesExpl ained.Click

End Sub

-------------------------------

The following error then appears in the error list:
-------------------------------
Handles clause requires a WithEvents variable defined in the containing type
or one of its base types.
-------------------------------
This is so annoying! I already have one link button successfully on the
page, with an event handler, and it is working fine!

Have you any idea why I cannot create a second one?!! I can't work it out!

--
welcome to the mooon !
Mar 8 '06 #1
3 4380
Are you using the same ID maybe in the basepage or somwhere else on the same page? Can you try to use a different ID? Can you reproduce the problem with a brand new project?

Let me know

Sonu Kapoor - [MVP]
W: http://www.DotNetSlackers.com
B: http://www.Kapoorsolutions.com/blog/
---
Posted via www.DotNetSlackers.com
Mar 8 '06 #2
DWS
Try copy and paste controls to new form. Error in the beta 2 designer wasn't
fixed.

Good Luck
DWS

"m00nm0nkey " wrote:
Hello

I have very recently moved from VS2003/ASP.Net 1.1 to VS2005/ASP.Net 2.0.

I have made up a web page which has many labels, image buttons and link
buttons. I am have a lot of trouble writing an event handler for a particular
link button and I have no idea why.

This is exactly what I am doing, step by step:
1. Add a link button to the form using the designer. Set control name as
"lbYourFilesExp lained", and I set the text and class properties. I then press
save.
2. I then double-click on the control. This opens up the code view
The following code appears:

-------------------------------

Protected Sub lbYourFilesExpl ained_Click(ByV al sender As Object, ByVal e As
System.EventArg s) Handles lbYourFilesExpl ained.Click

End Sub

-------------------------------

The following error then appears in the error list:
-------------------------------
Handles clause requires a WithEvents variable defined in the containing type
or one of its base types.
-------------------------------
This is so annoying! I already have one link button successfully on the
page, with an event handler, and it is working fine!

Have you any idea why I cannot create a second one?!! I can't work it out!

--
welcome to the mooon !

Mar 8 '06 #3
Thank you for your suggestions.

Unfortunately, the problem stems from the fact that I am a completely
incompetent buffoon.

I copied and pasted a .ASPX page into a new .ASPX to replicate a page
layout, and so it tried to share the same code-behind file, and this caused
several problems which are not the fault of the IDE.

I will now go and punish myself for my foolish behaviour.

Thank you kindly.

--
welcome to the mooon !
"Sonu Kapoor [MVP]" wrote:
Are you using the same ID maybe in the basepage or somwhere else on the same page? Can you try to use a different ID? Can you reproduce the problem with a brand new project?

Let me know

Sonu Kapoor - [MVP]
W: http://www.DotNetSlackers.com
B: http://www.Kapoorsolutions.com/blog/
---
Posted via www.DotNetSlackers.com

Mar 8 '06 #4

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

Similar topics

1
13573
by: Assaf Weinberg | last post by:
Using ASP.NET web form with VB.NET I have a page with a calendar control that onSelectionChanged builds a table control showing the events scheduled for the selected calendar days. One of the columns in this table contains linkbuttons that, when clicked, should execute some code (currently an event handler called showEvent) that displays details. I am currently using addhandler to specify the handler for
3
36687
by: CodeRazor | last post by:
I am creating an aspx page using C# and would like to be able to dynamically create linkbuttons that all run the same fuction on the click event. However, I would like the function to accept a single argument (in this case the file name) to identify which button was clicked. I am using the Command event handler. The link buttons load correctly, but when i click on a link, the event handler code does not execute. Any ideas?
10
2861
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
0
1549
by: BLiTZWiNG | last post by:
I have scoured the web to no avail. Any post that resembles my problem has no answer. I have an asp table on my page. I add rows and cells to it at run time with info provided from a database in a custom function. To one of those cells I add a new LinkButton, then wire a command event handler to it, which calls the custom function, thus bypassing any need to use IsPostBack. When a user clicks on the link button, nothing happens. I ran...
2
10783
by: msnews.microsoft.com | last post by:
I want to read information out of a database at runtime (names of files available to download) and create a list of linkbuttons that the user can click on to download the file(s). How can I accomplish this. I've got this far: In the html: .... table>
1
2327
by: geronimi | last post by:
I want to create a linkbutton in a cell because not every row needs one (so I can't setup a linkbuttoncolumn instead of a boundcolumn.) First, i create a linkbutton in the datagrid_ItemDataBound : Dim linkButton As New LinkButton linkButton.Text = name linkButton.CommandName = "PassSelectedClient" linkButton.CommandArgument = id I add it to the controls
3
2220
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
1907
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...
5
4720
by: =?Utf-8?B?TWFyYyBXb29sZnNvbg==?= | last post by:
Hi, I have a strange issue occurring with LinkButtons that are dynamically added to each (data) row of my DataGrid on that grid's ItemDataBound event. Each LinkButton is assigned its own event handler to deal with the Command event, but for some reason I can get this to work in a C# project but not in a newly created VB.NET one. The relevant VB.NET is as follows:
0
2047
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...
0
9605
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7669
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
6889
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
5554
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
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
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
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.