Showing posts with label subscribing. Show all posts
Showing posts with label subscribing. Show all posts

Saturday, March 31, 2012

Subscribing to event from Template Column

I have an ascx control in the ItemTemplate of a Template Column in a
datagrid. The control (myControl) raises an event.

I'm trying to figure out how I can subscribe to the event. It can't be done
at design time because myControl is not one of the recognized controls. At
run time I would expect to use AddHandler but I can't seem to reference
myControl.

How can I subscribe to the event?

Thanks,
THi Tina,

If your control is simply a composite control that is placed declaratively
on the page at design time then you can add the event handler within the ascx
codebehind file.

Alternatively, you can use event delegates to expose events out of your ascx
to its NamingContainer (in your case it is the DataGridItem) as I did in this
example: http://www.societopia.net/Samples/D...tDelegates.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com

"Tina" wrote:

> I have an ascx control in the ItemTemplate of a Template Column in a
> datagrid. The control (myControl) raises an event.
> I'm trying to figure out how I can subscribe to the event. It can't be done
> at design time because myControl is not one of the recognized controls. At
> run time I would expect to use AddHandler but I can't seem to reference
> myControl.
> How can I subscribe to the event?
> Thanks,
> T
>
I guess I'm going to have to learn c# if for nothing other than to follow
the examples...

in VB to handle an event we ....
AddHandler myControl.TimerEvent, AddressOf me.HandleTimerEvent
..
..
Protected Sub HandleTimerEvent(byval o as Object, byval e as TimerArgs)
.. code to handle event is here...
end sub

How would the AddHandler code look in the case where myControl is in
DataGrid1?

"Phillip Williams" <Phillip.Williams@.webswapp.com> wrote in message
news:0EF5A6EE-2CBF-4FDE-9B9F-148297D8E8CA@.microsoft.com...
> Hi Tina,
> If your control is simply a composite control that is placed declaratively
> on the page at design time then you can add the event handler within the
> ascx
> codebehind file.
> Alternatively, you can use event delegates to expose events out of your
> ascx
> to its NamingContainer (in your case it is the DataGridItem) as I did in
> this
> example: http://www.societopia.net/Samples/D...tDelegates.aspx
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tina" wrote:
>> I have an ascx control in the ItemTemplate of a Template Column in a
>> datagrid. The control (myControl) raises an event.
>>
>> I'm trying to figure out how I can subscribe to the event. It can't be
>> done
>> at design time because myControl is not one of the recognized controls.
>> At
>> run time I would expect to use AddHandler but I can't seem to reference
>> myControl.
>>
>> How can I subscribe to the event?
>>
>> Thanks,
>> T
>>
>>
>
Hi Tina,

For you to be able to handle an event (e.g. TimerEvent) raised by your
control it has to define a delegate method that you can use when placing that
control in the DataGrid. If it does that then you can handle that event by
specifying a function for the delegate method (e.g. if your event is named
TimerEvent, you should design your control to expose a method named
OnTimerEvent)

I created here
http://www.societopia.net/Samples/D...rolsEvents.aspx a sample
in VB.Net where I designed a user control (in an ascx file) that raises an
event (I called it CustomEvent1) by exposing a delegate method called
"OnCustomEvent1". I then included that control in a TemplateColumn on the
DataGrid and wired the delegate function named OnCustomEvents to an event
handler within the page class codebehind.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com

"Tina" wrote:

> I guess I'm going to have to learn c# if for nothing other than to follow
> the examples...
> in VB to handle an event we ....
> AddHandler myControl.TimerEvent, AddressOf me.HandleTimerEvent
> ..
> ..
> Protected Sub HandleTimerEvent(byval o as Object, byval e as TimerArgs)
> .. code to handle event is here...
> end sub
> How would the AddHandler code look in the case where myControl is in
> DataGrid1?
> "Phillip Williams" <Phillip.Williams@.webswapp.com> wrote in message
> news:0EF5A6EE-2CBF-4FDE-9B9F-148297D8E8CA@.microsoft.com...
> > Hi Tina,
> > If your control is simply a composite control that is placed declaratively
> > on the page at design time then you can add the event handler within the
> > ascx
> > codebehind file.
> > Alternatively, you can use event delegates to expose events out of your
> > ascx
> > to its NamingContainer (in your case it is the DataGridItem) as I did in
> > this
> > example: http://www.societopia.net/Samples/D...tDelegates.aspx
> > --
> > HTH,
> > Phillip Williams
> > http://www.societopia.net
> > http://www.webswapp.com
> > "Tina" wrote:
> >> I have an ascx control in the ItemTemplate of a Template Column in a
> >> datagrid. The control (myControl) raises an event.
> >>
> >> I'm trying to figure out how I can subscribe to the event. It can't be
> >> done
> >> at design time because myControl is not one of the recognized controls.
> >> At
> >> run time I would expect to use AddHandler but I can't seem to reference
> >> myControl.
> >>
> >> How can I subscribe to the event?
> >>
> >> Thanks,
> >> T
> >>
> >>
> >>
>

Subscribing to event from Template Column

I have an ascx control in the ItemTemplate of a Template Column in a
datagrid. The control (myControl) raises an event.
I'm trying to figure out how I can subscribe to the event. It can't be done
at design time because myControl is not one of the recognized controls. At
run time I would expect to use AddHandler but I can't seem to reference
myControl.
How can I subscribe to the event?
Thanks,
THi Tina,
If your control is simply a composite control that is placed declaratively
on the page at design time then you can add the event handler within the asc
x
codebehind file.
Alternatively, you can use event delegates to expose events out of your ascx
to its NamingContainer (in your case it is the DataGridItem) as I did in thi
s
example: http://www.societopia.net/Samples/D...tDelegates.aspx
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Tina" wrote:

> I have an ascx control in the ItemTemplate of a Template Column in a
> datagrid. The control (myControl) raises an event.
> I'm trying to figure out how I can subscribe to the event. It can't be do
ne
> at design time because myControl is not one of the recognized controls. A
t
> run time I would expect to use AddHandler but I can't seem to reference
> myControl.
> How can I subscribe to the event?
> Thanks,
> T
>
>
I guess I'm going to have to learn c# if for nothing other than to follow
the examples...
in VB to handle an event we ....
AddHandler myControl.TimerEvent, AddressOf me.HandleTimerEvent
.
.
Protected Sub HandleTimerEvent(byval o as Object, byval e as TimerArgs)
. code to handle event is here...
end sub
How would the AddHandler code look in the case where myControl is in
DataGrid1?
"Phillip Williams" <Phillip.Williams@.webswapp.com> wrote in message
news:0EF5A6EE-2CBF-4FDE-9B9F-148297D8E8CA@.microsoft.com...
> Hi Tina,
> If your control is simply a composite control that is placed declaratively
> on the page at design time then you can add the event handler within the
> ascx
> codebehind file.
> Alternatively, you can use event delegates to expose events out of your
> ascx
> to its NamingContainer (in your case it is the DataGridItem) as I did in
> this
> example: http://www.societopia.net/Samples/D...tDelegates.aspx
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tina" wrote:
>
Hi Tina,
For you to be able to handle an event (e.g. TimerEvent) raised by your
control it has to define a delegate method that you can use when placing tha
t
control in the DataGrid. If it does that then you can handle that event by
specifying a function for the delegate method (e.g. if your event is named
TimerEvent, you should design your control to expose a method named
OnTimerEvent)
I created here
http://www.societopia.net/Samples/D...rolsEvents.aspx a sampl
e
in VB.Net where I designed a user control (in an ascx file) that raises an
event (I called it CustomEvent1) by exposing a delegate method called
“OnCustomEvent1”. I then included that control in a TemplateColumn on t
he
DataGrid and wired the delegate function named OnCustomEvents to an event
handler within the page class codebehind.
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Tina" wrote:

> I guess I'm going to have to learn c# if for nothing other than to follow
> the examples...
> in VB to handle an event we ....
> AddHandler myControl.TimerEvent, AddressOf me.HandleTimerEvent
> ..
> ..
> Protected Sub HandleTimerEvent(byval o as Object, byval e as TimerArgs)
> .. code to handle event is here...
> end sub
> How would the AddHandler code look in the case where myControl is in
> DataGrid1?
> "Phillip Williams" <Phillip.Williams@.webswapp.com> wrote in message
> news:0EF5A6EE-2CBF-4FDE-9B9F-148297D8E8CA@.microsoft.com...
>
>

Subscription Form in e-mail

Hi,
Sales guy came up with this idea for clients subscribing to a new service they want to implement.

User's will fill out a subscribtion form, and the data on it will be submitted to the database. Once the subscribtion is approved, a confirmation mail is send to the user.

From my standpoint, I guessed the subscribtion form would be a normal page hosted on the host. But they want to MAIL this page to clients, and clients should be able to fill out the form in the mail.

Now one get this mails where the body is a web page (or so it seems). So I need to know if one can have a page on the internet, but this page can also be filled in from within a mail body. Know what I'm saying?

CheersHmm, maybe you could just email them a link to the form they need to fill out? But, you can send html type emails, so you could try setting up a form string of html, with your fields and such, and set the action of the form to your aspx page that is going to process the form. And then send the html string email to them.
Hmm, maybe you could just email them a link to the form they need to fill out?. Thought about that too, but boss allready saw mails containing web pages, so need to give him a honest answer if it's possible or not.
But, you can send html type emails, so you could try setting up a form string of html, with your fields and such, and set the action of the form to your aspx page that is going to process the form. And then send the html string email to them.Make sense with the bit I figured out so far. Can anyone else comment on this?
You might even be able to send an IFrame with the src set to your registration project, which then you wouldn't have to send a form through the email, and would be alot simpler.
that make sense. you mean the body of the mail is a iFrame, and the iFrame's src property is set to say www.MySite.com/services/newsletter/signup.aspx?
that make sense. you mean the body of the mail is a iFrame, and the iFrame's src property is set to say www.MySite.com/services/newsletter/signup.aspx?
Yeah, just make sure the email is sent as html, you can set this when/if you use SMTP mail. I'd say give the IFrame a go and see how it works out.

Good luck;