0

I am new to asp.net and I have user control and i am creating its instance. But for some reason all controls are null.

public static void LoadRulesLogic()
    {
        WebUserControls control = new WebUserControls();
        control.LoadRules(); //Controls null here
    }

How do i initialize all controls before calling LoadRules method?

Richa
  • 3,261
  • 2
  • 27
  • 51
  • 4
    What is `WebUserControls`? There is no standard .NET class having this name - so I suppose it is your custom class. Thus, it's hard to say what can be wrong without seeing its source. – Andrey Korneyev Oct 27 '15 at 13:40
  • @AndyKorneyev WebUserControl is my custom class which inherits System.Web.UI.UserControl class – Richa Oct 27 '15 at 13:41
  • @Richa can you show us the WebUserControls Class? – Sankar Oct 27 '15 at 13:43
  • Refer to this [How to find user control of an ASP.NET page](http://stackoverflow.com/questions/6828124/how-to-find-user-control-of-an-asp-net-page-inside-of-event-of-another-user-cont) You will need to find or load the UC in your page then use it. – Moe Oct 27 '15 at 13:52

0 Answers0