Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Calling Event Handlers Inside Custom Control

Reply
Thread Tools

Calling Event Handlers Inside Custom Control

 
 
mike.gilmore@jccteam.com
Guest
Posts: n/a
 
      02-02-2006
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
<PagingagingControlLabel
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox 3.5.5 crapping itself on large updates inside event handlers, just me? Nik Coughlin HTML 19 12-18-2009 04:06 PM
Firefox 3.5.5 crapping itself on large updates inside event handlers, just me? Nik Coughlin Javascript 22 12-18-2009 04:06 PM
User Control Page Load not firing (nor event handlers) in VS 2005 Dood ASP .Net 1 12-20-2005 10:31 PM
Capturing event from other custom control within another custom control Jonah Olsson ASP .Net 1 04-05-2005 01:39 PM
Capturing event from other custom control within another custom control Jonah Olsson ASP .Net Web Controls 2 04-05-2005 12:56 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57