Dynamically build ImageButton

V

Varangian

Hi there,

I'm using C# for a webapplication. In my page I'm building ImageButtons
dynamically on Page_Load. However I want to access these Images at
runtime for example when a user clicks a button for example.

I'm trying to use the FindControl but it returns a
System.Web.UI.Control not an System.Web.UI.WebControls, and altough
using GetType() function it returns that the found control is an
ImageButton. I need that further step to be able to access that
ImageButton.
Is there a way I can do this?

Thanks
 
G

Guest

Varangian said:
Hi there,

I'm using C# for a webapplication. In my page I'm building ImageButtons
dynamically on Page_Load. However I want to access these Images at
runtime for example when a user clicks a button for example.

I'm trying to use the FindControl but it returns a
System.Web.UI.Control not an System.Web.UI.WebControls, and altough
using GetType() function it returns that the found control is an
ImageButton. I need that further step to be able to access that
ImageButton.
Is there a way I can do this?

Thanks

Hi,

have you tried to use events? For example almost all of the components in C#
have the event onClick. If this happens you can access the image and the
information of the button easily. Their is a good documentation of events in
the MSDN Library.

mfg
 
V

Varangian

Hi blablabla :p

yes basically I'm creating an event click for each ImageButton created,
and using the sender I am being able to identity which image is being
clicked. Thats ok.

However if I have a button which is indepedent of the ImageButtons
created, but this button will use that ImageButton clicked all of its
properties... I don't know if you understood, i'm not very good in
making people understand me :|

thanks for your reply :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top