473,382 Members | 1,247 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,382 software developers and data experts.

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
"lbYourFilesExplained", 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 lbYourFilesExplained_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lbYourFilesExplained.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 4352
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
"lbYourFilesExplained", 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 lbYourFilesExplained_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles lbYourFilesExplained.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
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...
3
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...
10
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...
0
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...
2
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...
1
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...
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...
5
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.