Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.Net/C# - FindControl with Guid always one control in placeholder?

Posted on 2010-09-09
2
Medium Priority
?
594 Views
Last Modified: 2012-08-13
I am trying to figure out the simplest and cleanest way to handle this.  I have some code where I swap out the user control such as a textbox, dropdownlist etc.  I was naming the control the same ID name but that was causing errors.  I now have the same name and then appending a GUID to the end of it to make sure I stay unique on the control name.  How do I now do my findcontrol on it?  I was hoping I don't have to loop through all the controls or use Session but I may be heading down this road.  I don't want to use session at all for sure.  Is there a way to use FindControl and a partial string?  I know the start of it:

ID = "thenValue_" + guid,

Also I always only have 1 control in this placeholder at a time and if that can be used and checking to see if a control exists first that would also be perfect.

Thanks all
0
Comment
Question by:sbornstein2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 2000 total points
ID: 33637677
not getting the exact problem you are facing...
If you have single control in a PlaceHolder then looping should be a big problem...since you have a single contol.
To check number of controls you can use PlaceHolder1.Controls.Count
0
 

Author Closing Comment

by:sbornstein2
ID: 33711094
thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question