WebPart Title is not being rendered

Last post 05-12-2008 9:39 AM by vinz. 6 replies.

Sort Posts:

  • WebPart Title is not being rendered

    05-08-2008, 1:02 PM
    • Loading...
    • mpaterson
    • Joined on 11-26-2006, 10:24 PM
    • St. Petersburg, Florida
    • Posts 1,007

    I have created a UserControl that implements IWebPart but the title isn't being displayed.

     

    string IWebPart.Title
            {
                get
                {
                    if( m_Title != null )
                        return m_Title;
                    else
                    {
                        m_Title = "IWebPart, IWebActionable";
                        return m_Title;
                    }
                }
                set
                {
                    m_Title = value;
                }
            }

     I have tried it via code (above) and markup (below) 

    <asp:WebPartZone ID="WebPartZone2" runat="server">
                            <ZoneTemplate>
                                <uc2:IWebActionable ID="IWebActionable1" Title="IWebPart, IWebActionable" runat="server" />
                            </ZoneTemplate>
                        </asp:WebPartZone>
     

    Any ideas as to the problem?

    If everything happens for a reason what is the reason for this error?
  • Re: WebPart Title is not being rendered

    05-08-2008, 1:50 PM
    • Loading...
    • mpaterson
    • Joined on 11-26-2006, 10:24 PM
    • St. Petersburg, Florida
    • Posts 1,007

    I figured out the code behind for the user control and for the containing page.
    Not sure when the html isn't working.

    If everything happens for a reason what is the reason for this error?
  • Re: WebPart Title is not being rendered

    05-08-2008, 11:03 PM
    • Loading...
    • vinz
    • Joined on 10-05-2007, 11:47 AM
    • Cebu Philippines
    • Posts 6,481

    See my sample 

    UserControl that implements IWebPart Interface

    public partial class User_Controls_NewCalendar : System.Web.UI.UserControl, IWebPart

    {
        public string CatalogIconImageUrl
        {
            get { return "images/calendar.JPG"; }
            set { return; }
        }

        public string Description
        {
            get { return "This is the description."; }
            set { return; }
        }

        public string Subtitle
        {
            get { return ""; }
        }

        public string Title
        {
            get { return "My Calendar"; }
            set { return; }
        }

        public string TitleIconImageUrl
        {
            get { return "images/calendar.JPG"; }
            set { return; }
        }

        public string TitleUrl
        {
            get { return "~/Default.aspx"; }
            set { return; }
        }

      
        protected void Page_Load(object sender, EventArgs e)
        {

        
        }

    The just drag and drop the UserCOntrol in the WebZone and it will automatically displays the Title

    <WebPartsTemplate>
            <uc1:NewCalendar ID="NewCalendar1" runat="server" />
    </WebPartsTemplate>

    KeEp Rockin'
    Vincent Maverick Durano

    "Life is like music; it must be composed by ear, feeling, and instinct, not by rule..."

  • Re: WebPart Title is not being rendered

    05-09-2008, 12:30 PM
    • Loading...
    • mpaterson
    • Joined on 11-26-2006, 10:24 PM
    • St. Petersburg, Florida
    • Posts 1,007

    that's what I'm saying.
    The html way of setting the title isn't working.
    The code-behind is working fine.

    If everything happens for a reason what is the reason for this error?
  • Re: WebPart Title is not being rendered

    05-12-2008, 9:14 AM
    • Loading...
    • vinz
    • Joined on 10-05-2007, 11:47 AM
    • Cebu Philippines
    • Posts 6,481

    mpaterson:

    The html way of setting the title isn't working.
    The code-behind is working fine.

    This should work

    <ZoneTemplate>
              <uc5:TestUC ID="TestUC1" Title="A title" runat="server" />
    </ZoneTemplate>

    KeEp Rockin'
    Vincent Maverick Durano

    "Life is like music; it must be composed by ear, feeling, and instinct, not by rule..."

  • Re: WebPart Title is not being rendered

    05-12-2008, 9:29 AM
    • Loading...
    • mpaterson
    • Joined on 11-26-2006, 10:24 PM
    • St. Petersburg, Florida
    • Posts 1,007

    I know it should but it isn't.  Maybe it's because I have the WebPart.Title property in the UserControl?

     

    If everything happens for a reason what is the reason for this error?
  • Re: WebPart Title is not being rendered

    05-12-2008, 9:39 AM
    • Loading...
    • vinz
    • Joined on 10-05-2007, 11:47 AM
    • Cebu Philippines
    • Posts 6,481
    Well thats for you to figure it out...Try to remove the WebPart.Title property in your UC and see what happens..
    KeEp Rockin'
    Vincent Maverick Durano

    "Life is like music; it must be composed by ear, feeling, and instinct, not by rule..."

Page 1 of 1 (7 items)