Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • yumin 51 posts 243 karma points
    May 08, 2013 @ 11:34
    yumin
    0

    UserControl FindControl from masterpage get a NullReferenceException

    my masterpage have some server control like this:

    <form id="form1" runat="server">
    <umbraco:Macro Alias="aaa" runat="server"></umbraco:Macro>        
    <asp:HiddenField runat="server" ID="hidtest" Value="why i can not findcontrol" />    
    </form>

    Macro aaa call .NET User Control,in usercontrol the code like this:

     string val= ((HiddenField)this.Page.Master.FindControl("hidtest")).Value;

    but run will get a NullReferenceException,why i can not get a value from masterpage?

    thanks in advance

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies