If I have 10 imagebuttons on a form (imagebutton1, imagebutton2,
imagebutton3, etc.) in asp.net and I want to loop through each one and set
their imageurl in a loop how can this be done.
Something like :
dim i as int16
for i = 1 to 10
imagebutton(i).imageurl="whatever.jpg"
next
The code above does not work... is it possible to do this?
Thanks. 4 1452
dim ctl as Control
for each ctl in me.controls
if typeof ctl is imageButton
ctype(ctl, imageButton).imageurl = "whatever.jpg"
end if
next
"Jay" <msnews.microsoft.com> wrote in message
news:OQ**************@TK2MSFTNGP12.phx.gbl... If I have 10 imagebuttons on a form (imagebutton1, imagebutton2, imagebutton3, etc.) in asp.net and I want to loop through each one and set their imageurl in a loop how can this be done.
Something like :
dim i as int16 for i = 1 to 10 imagebutton(i).imageurl="whatever.jpg" next
The code above does not work... is it possible to do this?
Thanks.
check out this article for looping through controls, http://www.extremeexperts.com/Net/Ar...hControls.aspx
--
Saravana
Microsoft India Community Star,MC** www.extremeexperts.com
"Jay" <msnews.microsoft.com> wrote in message
news:OQ**************@TK2MSFTNGP12.phx.gbl... If I have 10 imagebuttons on a form (imagebutton1, imagebutton2, imagebutton3, etc.) in asp.net and I want to loop through each one and set their imageurl in a loop how can this be done.
Something like :
dim i as int16 for i = 1 to 10 imagebutton(i).imageurl="whatever.jpg" next
The code above does not work... is it possible to do this?
Thanks.
Thanks a lot. But what if I only wanted to set the imageurl for
imagebutton1, 2, 3 - 10? If there were other imagebuttons on the page they
would be set as well.
"Srinivas Kotipalli" <sr*******@sbcglobal.net> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl... dim ctl as Control for each ctl in me.controls if typeof ctl is imageButton ctype(ctl, imageButton).imageurl = "whatever.jpg" end if next
"Jay" <msnews.microsoft.com> wrote in message news:OQ**************@TK2MSFTNGP12.phx.gbl... If I have 10 imagebuttons on a form (imagebutton1, imagebutton2, imagebutton3, etc.) in asp.net and I want to loop through each one and
set their imageurl in a loop how can this be done.
Something like :
dim i as int16 for i = 1 to 10 imagebutton(i).imageurl="whatever.jpg" next
The code above does not work... is it possible to do this?
Thanks.
use a consistent naming convention for the image controls (e.g. image1,
image2 etc)
then something like
dim x as int16
dim ctrlname as string
dim img as Control
for x=1 to 10 ' or whatever
ctrlname="image" & x
img=FindControl(ctrlname) ' find name control
img.imageurl="someimage.jpg"
next
Hope that helps
Roger
"Jay" <msnews.microsoft.com> wrote in message
news:#4**************@TK2MSFTNGP10.phx.gbl... Thanks a lot. But what if I only wanted to set the imageurl for imagebutton1, 2, 3 - 10? If there were other imagebuttons on the page
they would be set as well.
"Srinivas Kotipalli" <sr*******@sbcglobal.net> wrote in message news:OR**************@TK2MSFTNGP10.phx.gbl... dim ctl as Control for each ctl in me.controls if typeof ctl is imageButton ctype(ctl, imageButton).imageurl = "whatever.jpg" end if next
"Jay" <msnews.microsoft.com> wrote in message news:OQ**************@TK2MSFTNGP12.phx.gbl... If I have 10 imagebuttons on a form (imagebutton1, imagebutton2, imagebutton3, etc.) in asp.net and I want to loop through each one and set their imageurl in a loop how can this be done.
Something like :
dim i as int16 for i = 1 to 10 imagebutton(i).imageurl="whatever.jpg" next
The code above does not work... is it possible to do this?
Thanks.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ryan Liu |
last post by:
How to loop though controls on the form?
I set each control's TabStop and TabIndex, but at run time, I press Tab key,
it jump though first control to last control and does not go back to the...
|
by: David A. Beck |
last post by:
Is there a way I can loop through a form object in ASP.NET codebehind like
in VB.NET and get all of the controls?
|
by: Ryan Ternier |
last post by:
Thanks for the previous help guys!
I got my list box issue working, but now i'm trying to loop through all the
items in my page.
I want to find each listbox, once I do i strip the ID down to...
|
by: sck10 |
last post by:
I changed my aspx page to use a master page. The problem is that I can no
longer loop through the controls on the content page. My question is how do
you loop through the controls on the master...
|
by: Brian |
last post by:
I have a list of plain HTML radio buttons that I want to be able to
loop through, get the values from them and insert them into a db. each
one should be a separate record... Can anyone please give...
|
by: Kezza |
last post by:
Hi There..
I have dynamically created some textbox and checkbox controls by adding them
to a panel. Now I would like to get the values out.
I have created a
for each loop that I can see the...
|
by: dominique |
last post by:
Hi,
Is it possible (in vb.net with WinForms) to loop throw controls inside a
container (form or panel) sorting the controls on a property (.tabindex
for example) ?
My problem : on several...
|
by: J L |
last post by:
I need to loop through a form's controls collection and delete some
based on type and location. I have tried For..Each and For i = 0 to
form.controls.count - 1 but when I delete any it messes up...
|
by: Derek Hart |
last post by:
I am going in circles trying to loop through properties on 3rd party
controls. For example, I have a textbox that has its maximum length located
at MyTextBox.Properties.MaxLength - instead of the...
|
by: tlhintoq |
last post by:
Situation:
A Windows Form with a single User Control containing 4 custom controls. This lets me drop the User Control on its own form to make it a dialog, or make it part of a larger configuration...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
| |