Search code examples
c#asp.netweb-controls

How to retrieve ID for a CUSTOM CONTROL


I have a Custom Control registered in the page using this code:

<%@ Register Assembly="WebProject.Core" Namespace="WebProject.Core.UserInterfaces.TinyMCE"
    TagPrefix="tinyMCE" %>

the Custom Control is placed on page with:

<tinyMCE:TextEditor runat="server" ID="uxContentAuthorInput" Mode="Full" />

To FIND the Control I use:

            TextBox myContentAuthor = (TextBox)uxAuthorListDetailsView.FindControl("uxContentAuthorInput");

but DOES NOT WORK.

  • What I am doing wrong?
  • Could you provide an example of code?

Thanks for your help


Solution

  • Try this..

    Add:

    Using WebProject.Core.UserInterfaces.TinyMCE;
    

    And change the control to import the correct type:

    TextEditor myContentAuthor = (TextEditor)uxAuthorListDetailsView.FindControl("uxContentAuthorInput");