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

Calling Event Handlers Inside Custom Control

Hi,

I've created a custom control that contains a collection of link
buttons (PagingControl.vb). I want an event to fire when the link
button is clicked.

The event handler is located in my primary asp.net file
(ShowData.aspx). However, when I attempt to compile my class file, I
get an error because the event the link button is attempting to wire to
doesn't exist.

Unfortunately, my fix isn't as simple as moving my event handler from
ShowData.aspx to the class because that function class another function
local to the page.

Ideally I want my PagingControl.vb file to become part of my control
library and accessible to all of my different web applications. The
abbreviated code for the two files is shown below.

Thanks in advance,

Mike

ShowData.aspx

Public Sub ChangePage(Sender as Object, e as CommandEventArgs)
lblClickValue = "It worked! " & e.CommandArgument
End Sub
<Paging:PagingControlLabel
id="lblPaging"
width="100%"
Runat="Server"/>

<br/>

<asp:Label
id="lblClickValue"
runat="server"/>

PagingControls.vb

Dim objLb as LinkButton

For loop = start_page to end_page

objLb = New LinkButton
objLb.Text = loop
objLb.CommandName = "lb" & loop
objLb.CommandArgument = loop

addHandler objLb.Command, AddressOf ChangePage

Next

Feb 2 '06 #1
0 1032

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

Similar topics

2
by: Tamir Khason | last post by:
I build user control, consists of different things (e.g label, image, etc.) I want to handle click (and other) events, however I can not do it until I do not assign event handler for each control...
18
by: bhavin | last post by:
Hi, Can someone point me to some good best practices kind of documentation on use of events compared to method overriding. Ex. In Windows Forms when should i have an event handler for Paint, and...
3
by: NWx | last post by:
Hi, I defined a base class, Panel, based on System.Web.UI.UserControl, as below: Public MustInherit Class Panel Inherits System.Web.UI.UserControl ..... In another module, I want to...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
9
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it...
4
by: Mike Gaab | last post by:
I am having two problems: 1. Determing the signature of event handlers for any control that raises events. I have a handle on the arguments but the method name is not clear. 2. What is the...
16
by: Hamed | last post by:
Hello I am developing a utility to be reused in other programs. It I have an object of type Control (a TextBox, ComboBox, etc.) that other programmers use it in applications. they may set some...
14
by: Hamed | last post by:
Hello It seems that I should implement ICloneable to implement my own clone object. the critical point for me is to make a control object based on another control object that all of its event...
1
by: centur | last post by:
Hello. I created simple asp.net application to search message history over Office Live Communicator conversations. I complete quite all job but stick with one thing - I have autosuggest box...
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: 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: 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...
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
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...

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.