473,385 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dynamically build ImageButton

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

Jan 9 '06 #1
2 1413


"Varangian" wrote:
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
Jan 9 '06 #2
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 :)

Jan 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Meena | last post by:
I added a panel control and a image button inside the panel in a webform. When I try to dynamically add the textbox on top of the image, in the imagebutton click event, the textbox was not displayed....
2
by: Danny Bloodworth | last post by:
I have a usercontrol (login.ascx) that is very simple. It accepts input through two textboxes, and then the user clicks an Imagebutton to submit. I have a parent form that checks the page...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
3
by: sck10 | last post by:
Hello, When a person subits my web page, I do a simple check (validation) and if there are any errors, I create a variable (strValidateText) and set that value to a label on the form. What I...
2
by: Bruce | last post by:
I have a button on a form that creates multiple ImageButtons; I want each ImageButton's click event to then redirect to another URL. From doing some research, I understand this has to do with...
4
by: Jordan | last post by:
I need to dynamically add an ImageButton control to a user control and and do some server-side processing when the user clicks it. While I the ImageButton is added to the user control at runtime,...
0
by: Varangian | last post by:
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...
0
by: krish | last post by:
hi, I am dynamically generating Imagebutton (say 5 imagebutton, in loop) . for each imagebutton url , i am dynamically generating image and assigining to it. every thing is ok upto this...
1
by: stimul8d | last post by:
okay; ASP. I have i listbox inside a user control which is dynamically created on page_init. I check for postback and only populate the datasource if it's false. regardless, i do this ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.