Thanks for the response. We have implemented your suggestion and it works
beautifully. However, we are still somewhat confused as to what may be the
"side effects" of this. We couldn't come up with a good reason why ms's
you have suggested below. After decompiling the built in method, we are
disabled, tabIndex and so on. The problem with trying to use the one's
"Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
news:oULhwloaGHA.880@TK2MSFTNGXA01.phx.gbl...
> Hi Jim,
>
> Welcome to the ASP.NET newsgroup.
>
> From your description, I understand you're developing a custom label
> control which will use the Render out some custom attributes, and you're
> using the "AddAttributesToRender" method to add some certain attributes
> into the control tag, and one of them is a string value reference to other
> control on the page. However, when you try using the FindControl method to
> locate other control on the page, you're getting error, correct?
>
> Based on my understanding, the FindControl method will only search the
> control (by id) in the current NamingContainer.
>
> #Control.FindControl Method (String)
>
http://msdn2.microsoft.com/en-us/library/486wc64h.aspx >
> And as for your scenario, your custom control has implemented the
> INamingContainer interface, then, the FindControl method of itself will
> only be able to find control in its own child control collection. And for
> other controls at the same level (in the same parent NamingContainer), it
> will not be able to find them. We have to call the FindControl on the
> parent NamingContainer, like:
>
> ===============================
> protected override void AddAttributesToRender(HtmlTextWriter writer)
> {
>
> writer.AddAttribute(HtmlTextWriterAttribute.Id, ID);
>
>
> if (!string.IsNullOrEmpty(AssociatedControlID))
> {
> Control ctrl =
> this.NamingContainer.FindControl(AssociatedControlID);
>
> writer.AddAttribute(HtmlTextWriterAttribute.For,
> ctrl.ClientID);
> }
>
> }
> ============================
>
> Hope this helps.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Community Support
>
>
> ==================================================
>
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
>
> ==================================================
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
> Get Secure!
www.microsoft.com/security > (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>