When a control is a naming container and an attempt to find a control with non-segmented id (e.g. 'myControl') is made,
the search continues to the control's naming container if pathOffset is 0, that is we're at the start of the search.
return null;
int separatorIdx = id.IndexOf (IdSeparator, pathOffset);
- if (separatorIdx == -1)
- return LookForControlByName (id.Substring (pathOffset));
+ if (separatorIdx == -1) {
+ if (pathOffset == 0) {
+ namingContainer = NamingContainer;
+ if (namingContainer != null) {
+ Control ctl = namingContainer.FindControl (id);
+ if (ctl != null)
+ return ctl;
+ }
+ }
+
+ return LookForControlByName (pathOffset > 0 ? id.Substring (pathOffset) : id);
+ }
string idfound = id.Substring (pathOffset, separatorIdx - pathOffset);
namingContainer = LookForControlByName (idfound);