473,412 Members | 1,973 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,412 software developers and data experts.

multiple controls with same ID

say I have a Datalist and each row has a image control with ID "MyImg". I am
hiding/showing each image based on a result from the database. I need to
find that particular img control to access it's properties. Obviously it
isn't possible to just say FindControl("MyImg") since there are multiple
instances of it. I once found an article on this subject but cannot find it
now, anyone?
Nov 19 '05 #1
1 1257
Daves:
Your statement isn't fully accurate. You can use FindControl("MyImg")
within the image's parent control and all will work as expected. For
example ,if you are in the ItemDataBound event, you could do
e.Item.FindControl("MyImg") e is the argument which is received.

If you aren't in the ItemDataBoundEvent you can simply loop thorugh all the
items of the datalist'

for each item as DataListItem in myList.Items
'item.FindControl
next
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Daves" <db****@simnet.is> wrote in message
news:uK*************@TK2MSFTNGP09.phx.gbl...
say I have a Datalist and each row has a image control with ID "MyImg". I
am hiding/showing each image based on a result from the database. I need
to find that particular img control to access it's properties. Obviously
it isn't possible to just say FindControl("MyImg") since there are
multiple instances of it. I once found an article on this subject but
cannot find it now, anyone?

Nov 19 '05 #2

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

Similar topics

0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
2
by: Anders Borum | last post by:
Hello! I'm building pages dynamically, by loading usercontrols recursively and adding the to eachother. My problem is usercontrols - defined with output-caching directives. When these...
2
by: Bal Ghuman | last post by:
Hi Guys I've got an ASP.NET application that dynamically creates a navigation table from an XML file and then Loads a user control according to which link has been selected. The control...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
0
by: PB | last post by:
According to the documentation, ParseControl returns a parsed control from an input string. The documentation seems to assume that *one* control will be parsed from the string. My implementation...
3
by: Nathan Sokalski | last post by:
When I view any page in my application a second time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize) +313...
1
by: SteveComplex | last post by:
I'm currently working on a project developing a web application that makes heavy use of 3rd-party controls, popup windows and frames ( not my design I hasten to add ). Some of the pages make use...
11
by: Ranginald | last post by:
This question is about how to handle an .aspx page that references multiple methods and where to store these methods (e.g. one codefile or multiple codefiles). PREFACE ======== I have a simple...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
3
by: =?Utf-8?B?a3dvbmd0aw==?= | last post by:
error message found in server A "Multiple controls with the same ID 'batchEndorseworklist' were found. Trace requires that controls have unique IDs." but in server B is normal why? thank you
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
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...
0
isladogs
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.