FindControl Problem

2 posts, 0 answers
  1. Zaheer
    Zaheer avatar
    2 posts
    Member since:
    Apr 2012

    Posted 05 Apr 2012 Link to this post

    I am Using two ascx files in one aspx file
    a.ascx
        raddock1
        raddock2
    b.ascx
        raddock3
        raddock4

    main aspx
    radzone 1
    radzone2

    i want to display raddock1 in radzone2 of aspx
    but when i use findcontrol it will return me null

     

  2. Zaheer
    Zaheer avatar
    2 posts
    Member since:
    Apr 2012

    Posted 06 Apr 2012 Link to this post

     

     

    This function resolve my problem

    private
    Control FindControlRecursive(Control rootControl, string controlID)

     

    {

     

     

    if (rootControl.ID == controlID) return rootControl;

     

     

     

    foreach (Control controlToSearch in rootControl.Controls)

     

    {

     

     

     

    Control controlToReturn =

     

     

    FindControlRecursive(controlToSearch, controlID);

     

     

     

    if (controlToReturn != null) return controlToReturn;

     

     

    }

     

     

     

    return null;

     

    }

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top