Connecting Tech Pros Worldwide Help | Site Map

Passing subroutine 'Sender' and 'e' (EventArgs) manually?

mj.redfox.mj@gmail.com
Guest
 
Posts: n/a
#1: Feb 19 '07
Hi,

Pretty basic question, apologies but being a bit of a newbie I still
don't know the answer to this kind of thing!


I have a repeater which, upon databind calls a subroutine, as below:

ASPX PAGE
-------------------
<asp:Repeater ID="repAssigneeGroups" runat="server" DataSource='<
%#Container.DataItem.Row.GetChildRows("relAssignee Groups")%>'
OnItemDataBound="Test_Sub">

And the subroutine is as below:

VB PAGE
---------------
Public Sub Test_Sub(ByVal Sender As Object, ByVal e As
RepeaterItemEventArgs)


Now this all works fine, as Sender and e are passed automatically.
However, in addition to these, I also need to pass a couple of my own
variables. The problem is that as soon as I start passing anything in,
it expects me to MANUALLY pass Sender and the event args as well, and
I'm afraid I have no idea how to do this. So basically all I'm asking
is how do I generate and pass the repeater 'sender' and 'eventargs'
information manually. Can anyone help at all?

Just to summarise, this is what I need to do (asterisks for the parts
I'm missing):

ASPX PAGE
-------------------
<asp:Repeater ID="repAssigneeGroups" runat="server" DataSource='<
%#Container.DataItem.Row.GetChildRows("relAssignee Groups")%>'
OnItemDataBound="Test_Sub(****, ****, myval1, myval2)">

VB PAGE
---------------
Public Sub Test_Sub(ByVal Sender As Object, ByVal e As
RepeaterItemEventArgs, ByVal myval1 as integer, ByVal myval2 as
integer)

bruce barker
Guest
 
Posts: n/a
#2: Feb 19 '07

re: Passing subroutine 'Sender' and 'e' (EventArgs) manually?


OnItemDataBound is a delegate, you can not change its signature
(parameter list). if you want it different you need to define a new
delegate. you would do this by creating a new repeater (inherit from
repeater), and create a new delegate.

also as OnItemDataBound is a delegate, it wants a delegate (routine
name), not a method with parameters.

-- bruce (sqlwork.com)

mj.redfox.mj@gmail.com wrote:
Quote:
Hi,
>
Pretty basic question, apologies but being a bit of a newbie I still
don't know the answer to this kind of thing!
>
>
I have a repeater which, upon databind calls a subroutine, as below:
>
ASPX PAGE
-------------------
<asp:Repeater ID="repAssigneeGroups" runat="server" DataSource='<
%#Container.DataItem.Row.GetChildRows("relAssignee Groups")%>'
OnItemDataBound="Test_Sub">
>
And the subroutine is as below:
>
VB PAGE
---------------
Public Sub Test_Sub(ByVal Sender As Object, ByVal e As
RepeaterItemEventArgs)
>
>
Now this all works fine, as Sender and e are passed automatically.
However, in addition to these, I also need to pass a couple of my own
variables. The problem is that as soon as I start passing anything in,
it expects me to MANUALLY pass Sender and the event args as well, and
I'm afraid I have no idea how to do this. So basically all I'm asking
is how do I generate and pass the repeater 'sender' and 'eventargs'
information manually. Can anyone help at all?
>
Just to summarise, this is what I need to do (asterisks for the parts
I'm missing):
>
ASPX PAGE
-------------------
<asp:Repeater ID="repAssigneeGroups" runat="server" DataSource='<
%#Container.DataItem.Row.GetChildRows("relAssignee Groups")%>'
OnItemDataBound="Test_Sub(****, ****, myval1, myval2)">
>
VB PAGE
---------------
Public Sub Test_Sub(ByVal Sender As Object, ByVal e As
RepeaterItemEventArgs, ByVal myval1 as integer, ByVal myval2 as
integer)
>
mj.redfox.mj@gmail.com
Guest
 
Posts: n/a
#3: Feb 20 '07

re: Passing subroutine 'Sender' and 'e' (EventArgs) manually?


Thanks Bruce, I think I need to try a different approach with my code
on this one.

Closed Thread