Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sbornstein2
sbornstein2

ASKER

thanks