CompositeControl Errors GetWebResourceURL RRS feed

  • Question

  • User-1226263862 posted

    I'm creating a custom server control which inherits the CompositeControl class with a TextBox, AJAX CalendarExtender, Image and CompareValidator and UpdatePanel controls.  When I debug my code it errors out when I assign an ImageURL to the Image control.  Pretty simple code:

    protected override void CreateChildControls()
        image.ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType), "ControlLibrary.Server.Custom.Resources.calendar.jpg");

    If I inherit the WebControl, INamingContainer classes, it works fine although I run into issues with ViewState and persisting values on postback.

    Suggestions? Comments?

    I did follow this MSDN example: http://msdn.microsoft.com/en-us/library/3257x3ea.aspx


    Tuesday, June 5, 2012 9:55 AM


  • User-1226263862 posted

    Had a minor syntax error and needed to place the code above in the OnPreRender event.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 5, 2012 11:39 AM