Anupama Singh

Anupama Singh

  • NA
  • 141
  • 133.7k

Custom Control

Jun 16 2009 5:00 AM

Actually I am facing some problem with custom control.

 

I have created one custom control (Composite type)

 

 

Ex: <main control id="Contol1" runat="server">

            <innerSubControl>

                       

                        ---- Asp controls---

 

            </innerSubControl>

      </main control>

                         

It renders fine , but if I put  <asp:label or any asp server control inside it , and accessing it from code behind , it gives error

 

 

Like—

 

<main control id="Contol1" runat="server">

            <innerSubControl>

                       

                        <asp:label id="lbl1" runat="server"></asp:label>              

 

            </innerSubControl>

      </main control>

 

-------And in code behind

Unable to get lbl1  Error::: -- Compiler Error Message: CS0103: The name 'lbl1' does not exist in the current context

 

What lines I want to add in custom control so that I can access inside controls directly –

I don't want to use Find control .. becoz for each and every control to access using find control is tedious Job

 


Answers (1)