Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Events fired from dynamically created controls-VB.net

Reply
Thread Tools

Events fired from dynamically created controls-VB.net

 
 
ebown5@gmail.com
Guest
Posts: n/a
 
      08-01-2006
I am programming in vb.net and haven't quite grokked how to accomplish
this task. I am a pretty proficient amateur and guessing that this is a
relatively simple problem for an experienced object oriented
programmer.

I am dynamically adding images to a webpage. Based on the data there
may be 1 to n images on any given page. I want to provide for the
ability to click on the images and direct the user to another url. I am
trying to use imagebuttons for this task.

I am having trouble handling the click event for the imagebuttons
though since they are dynamically added.

To solve this problem I tried to create a custom class called
myimagebutton that inherits from imagebutton. I figured that every time
that I dynamically created an imagebutton that I would dynamically
create an instance of the myimagebutton class instead. Myimagebutton
would have a click event, and I would handle the event accordingly.

Unfortunately, this problem is just beyond my current understanding of
custom classes and events, and the tutorials that I have read are just
not getting through to me.

Could someone please elucidate for me in simple terms how I would
create a click event for my custom class and how I would handle it? Is
creating a custom imagebutton class even the way to solve this issue?

Thanks for any light that you guys can shed on this for me.

Eric

 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      08-01-2006
hi Eric, Instead of an imagebutton, try and use a HyperLink control and set
its imageurl property to the url of your image. Since you do not need a
click event to occur on the serverside before you can redirect the user,
this should work out well for you. In this way you wont need to uselessly
bother with wiring up unnecessary events which you wont be using to start
with, while also avoiding a roundtrip to your server before redirecting.
Instead, in this manner, now you will be setting the NavigateUrl property to
the url you want to the user directed to.

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

<(E-Mail Removed)> ha scritto nel messaggio
news:(E-Mail Removed) oups.com...
>I am programming in vb.net and haven't quite grokked how to accomplish
> this task. I am a pretty proficient amateur and guessing that this is a
> relatively simple problem for an experienced object oriented
> programmer.
>
> I am dynamically adding images to a webpage. Based on the data there
> may be 1 to n images on any given page. I want to provide for the
> ability to click on the images and direct the user to another url. I am
> trying to use imagebuttons for this task.
>
> I am having trouble handling the click event for the imagebuttons
> though since they are dynamically added.
>
> To solve this problem I tried to create a custom class called
> myimagebutton that inherits from imagebutton. I figured that every time
> that I dynamically created an imagebutton that I would dynamically
> create an instance of the myimagebutton class instead. Myimagebutton
> would have a click event, and I would handle the event accordingly.
>
> Unfortunately, this problem is just beyond my current understanding of
> custom classes and events, and the tutorials that I have read are just
> not getting through to me.
>
> Could someone please elucidate for me in simple terms how I would
> create a click event for my custom class and how I would handle it? Is
> creating a custom imagebutton class even the way to solve this issue?
>
> Thanks for any light that you guys can shed on this for me.
>
> Eric
>



 
Reply With Quote
 
 
 
 
ebown5@gmail.com
Guest
Posts: n/a
 
      08-02-2006
Thanks Alessandro!

That is exactly the kind of response that helps me out. I was trying to
solve a problem that quickly got very complex and I didn't realize that
there were simpler solutions out there.

I never knew that you could use hyperlinks in this way, and will put
this idea to test very soon.

Thanks again. Eric

Alessandro Zifiglio wrote:
> hi Eric, Instead of an imagebutton, try and use a HyperLink control and set
> its imageurl property to the url of your image. Since you do not need a
> click event to occur on the serverside before you can redirect the user,
> this should work out well for you. In this way you wont need to uselessly
> bother with wiring up unnecessary events which you wont be using to start
> with, while also avoiding a roundtrip to your server before redirecting.
> Instead, in this manner, now you will be setting the NavigateUrl property to
> the url you want to the user directed to.
>
> Regards,
> Alessandro Zifiglio
> http://www.AsyncUI.net
>
> <(E-Mail Removed)> ha scritto nel messaggio
> news:(E-Mail Removed) oups.com...
> >I am programming in vb.net and haven't quite grokked how to accomplish
> > this task. I am a pretty proficient amateur and guessing that this is a
> > relatively simple problem for an experienced object oriented
> > programmer.
> >
> > I am dynamically adding images to a webpage. Based on the data there
> > may be 1 to n images on any given page. I want to provide for the
> > ability to click on the images and direct the user to another url. I am
> > trying to use imagebuttons for this task.
> >
> > I am having trouble handling the click event for the imagebuttons
> > though since they are dynamically added.
> >
> > To solve this problem I tried to create a custom class called
> > myimagebutton that inherits from imagebutton. I figured that every time
> > that I dynamically created an imagebutton that I would dynamically
> > create an instance of the myimagebutton class instead. Myimagebutton
> > would have a click event, and I would handle the event accordingly.
> >
> > Unfortunately, this problem is just beyond my current understanding of
> > custom classes and events, and the tutorials that I have read are just
> > not getting through to me.
> >
> > Could someone please elucidate for me in simple terms how I would
> > create a click event for my custom class and how I would handle it? Is
> > creating a custom imagebutton class even the way to solve this issue?
> >
> > Thanks for any light that you guys can shed on this for me.
> >
> > Eric
> >


 
Reply With Quote
 
ebown5@gmail.com
Guest
Posts: n/a
 
      08-02-2006
Thanks Alessandro!

That is exactly the kind of response that helps me out. I was trying to
solve a problem that quickly got very complex and I didn't realize that
there were simpler solutions out there.

I never knew that you could use hyperlinks in this way, and will put
this idea to test very soon.

Thanks again. Eric

Alessandro Zifiglio wrote:
> hi Eric, Instead of an imagebutton, try and use a HyperLink control and set
> its imageurl property to the url of your image. Since you do not need a
> click event to occur on the serverside before you can redirect the user,
> this should work out well for you. In this way you wont need to uselessly
> bother with wiring up unnecessary events which you wont be using to start
> with, while also avoiding a roundtrip to your server before redirecting.
> Instead, in this manner, now you will be setting the NavigateUrl property to
> the url you want to the user directed to.
>
> Regards,
> Alessandro Zifiglio
> http://www.AsyncUI.net
>
> <(E-Mail Removed)> ha scritto nel messaggio
> news:(E-Mail Removed) oups.com...
> >I am programming in vb.net and haven't quite grokked how to accomplish
> > this task. I am a pretty proficient amateur and guessing that this is a
> > relatively simple problem for an experienced object oriented
> > programmer.
> >
> > I am dynamically adding images to a webpage. Based on the data there
> > may be 1 to n images on any given page. I want to provide for the
> > ability to click on the images and direct the user to another url. I am
> > trying to use imagebuttons for this task.
> >
> > I am having trouble handling the click event for the imagebuttons
> > though since they are dynamically added.
> >
> > To solve this problem I tried to create a custom class called
> > myimagebutton that inherits from imagebutton. I figured that every time
> > that I dynamically created an imagebutton that I would dynamically
> > create an instance of the myimagebutton class instead. Myimagebutton
> > would have a click event, and I would handle the event accordingly.
> >
> > Unfortunately, this problem is just beyond my current understanding of
> > custom classes and events, and the tutorials that I have read are just
> > not getting through to me.
> >
> > Could someone please elucidate for me in simple terms how I would
> > create a click event for my custom class and how I would handle it? Is
> > creating a custom imagebutton class even the way to solve this issue?
> >
> > Thanks for any light that you guys can shed on this for me.
> >
> > Eric
> >


 
Reply With Quote
 
ebown5@gmail.com
Guest
Posts: n/a
 
      08-02-2006
Followup:

Worked absolutely perfectly!

Exactly the way I wanted it to work.


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Thanks Alessandro!
>
> That is exactly the kind of response that helps me out. I was trying to
> solve a problem that quickly got very complex and I didn't realize that
> there were simpler solutions out there.
>
> I never knew that you could use hyperlinks in this way, and will put
> this idea to test very soon.
>
> Thanks again. Eric
>
> Alessandro Zifiglio wrote:
> > hi Eric, Instead of an imagebutton, try and use a HyperLink control and set
> > its imageurl property to the url of your image. Since you do not need a
> > click event to occur on the serverside before you can redirect the user,
> > this should work out well for you. In this way you wont need to uselessly
> > bother with wiring up unnecessary events which you wont be using to start
> > with, while also avoiding a roundtrip to your server before redirecting.
> > Instead, in this manner, now you will be setting the NavigateUrl property to
> > the url you want to the user directed to.
> >
> > Regards,
> > Alessandro Zifiglio
> > http://www.AsyncUI.net
> >
> > <(E-Mail Removed)> ha scritto nel messaggio
> > news:(E-Mail Removed) oups.com...
> > >I am programming in vb.net and haven't quite grokked how to accomplish
> > > this task. I am a pretty proficient amateur and guessing that this is a
> > > relatively simple problem for an experienced object oriented
> > > programmer.
> > >
> > > I am dynamically adding images to a webpage. Based on the data there
> > > may be 1 to n images on any given page. I want to provide for the
> > > ability to click on the images and direct the user to another url. I am
> > > trying to use imagebuttons for this task.
> > >
> > > I am having trouble handling the click event for the imagebuttons
> > > though since they are dynamically added.
> > >
> > > To solve this problem I tried to create a custom class called
> > > myimagebutton that inherits from imagebutton. I figured that every time
> > > that I dynamically created an imagebutton that I would dynamically
> > > create an instance of the myimagebutton class instead. Myimagebutton
> > > would have a click event, and I would handle the event accordingly.
> > >
> > > Unfortunately, this problem is just beyond my current understanding of
> > > custom classes and events, and the tutorials that I have read are just
> > > not getting through to me.
> > >
> > > Could someone please elucidate for me in simple terms how I would
> > > create a click event for my custom class and how I would handle it? Is
> > > creating a custom imagebutton class even the way to solve this issue?
> > >
> > > Thanks for any light that you guys can shed on this for me.
> > >
> > > Eric
> > >


 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      08-02-2006
You are welcome, Eric

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

<(E-Mail Removed)> ha scritto nel messaggio
news:(E-Mail Removed) oups.com...
> Thanks Alessandro!
>
> That is exactly the kind of response that helps me out. I was trying to
> solve a problem that quickly got very complex and I didn't realize that
> there were simpler solutions out there.
>
> I never knew that you could use hyperlinks in this way, and will put
> this idea to test very soon.
>
> Thanks again. Eric
>
> Alessandro Zifiglio wrote:
>> hi Eric, Instead of an imagebutton, try and use a HyperLink control and
>> set
>> its imageurl property to the url of your image. Since you do not need a
>> click event to occur on the serverside before you can redirect the user,
>> this should work out well for you. In this way you wont need to uselessly
>> bother with wiring up unnecessary events which you wont be using to start
>> with, while also avoiding a roundtrip to your server before redirecting.
>> Instead, in this manner, now you will be setting the NavigateUrl property
>> to
>> the url you want to the user directed to.
>>
>> Regards,
>> Alessandro Zifiglio
>> http://www.AsyncUI.net
>>
>> <(E-Mail Removed)> ha scritto nel messaggio
>> news:(E-Mail Removed) oups.com...
>> >I am programming in vb.net and haven't quite grokked how to accomplish
>> > this task. I am a pretty proficient amateur and guessing that this is a
>> > relatively simple problem for an experienced object oriented
>> > programmer.
>> >
>> > I am dynamically adding images to a webpage. Based on the data there
>> > may be 1 to n images on any given page. I want to provide for the
>> > ability to click on the images and direct the user to another url. I am
>> > trying to use imagebuttons for this task.
>> >
>> > I am having trouble handling the click event for the imagebuttons
>> > though since they are dynamically added.
>> >
>> > To solve this problem I tried to create a custom class called
>> > myimagebutton that inherits from imagebutton. I figured that every time
>> > that I dynamically created an imagebutton that I would dynamically
>> > create an instance of the myimagebutton class instead. Myimagebutton
>> > would have a click event, and I would handle the event accordingly.
>> >
>> > Unfortunately, this problem is just beyond my current understanding of
>> > custom classes and events, and the tutorials that I have read are just
>> > not getting through to me.
>> >
>> > Could someone please elucidate for me in simple terms how I would
>> > create a click event for my custom class and how I would handle it? Is
>> > creating a custom imagebutton class even the way to solve this issue?
>> >
>> > Thanks for any light that you guys can shed on this for me.
>> >
>> > Eric
>> >

>



 
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
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Embedded <divs> with events: How to prevent the parent div's eventfrom being fired when the embedded div's event is fired? Num GG Javascript 2 11-17-2008 08:56 PM
Dynamically Created Gridview - Paging events are not fired ami ASP .Net 2 05-30-2007 08:22 AM
Events not fired for Dynamically Created Controls in VS2005 ASP.NET 2.0 Richard Huang ASP .Net Web Controls 1 01-09-2006 03:16 AM
Managing ViewState of a dynamically created Custom Composite Server Control -(where the original is also dynamically created) dickster ASP .Net Building Controls 0 12-08-2005 09:32 AM



Advertisments