Solved

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

Posted on 2010-09-09
2
579 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
2 Comments
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now