Search code examples
c#asp.netweb-applicationsweb-partswebpartpage

Web Part Zone Title shows Untitled[0] in ASP.NET


I have a panel placed inside a webpart which holds a chart . The title of the webpart zone is Untitled[0],Untitled[1]....There is no title tag in the panel control or web part . Any one know how to solve this .


Solution

  • Try with this:

                <asp:WebPartZone Height="100px" Width="75%" runat="server" 
                    ID="productSummaryZone" HeaderText="Product summary">
                    <ZoneTemplate>
                        <uc:ProductSummary title="Product summary title" runat="server" ID="productSummary" />
                    </ZoneTemplate>
                </asp:WebPartZone>
    
    • HeaderText="Product summary". This header is used to identify your web part when you are in edit, design mode or connect mode (this is not the title)

    • <uc:ProductSummary title="Product summary title" runat="server" ID="productSummary" />. This represents a UserControl in this case, and this was added in the ZoneTemplate, as you can see, you can pass a title="..." to your UserControl even when you do not have declared a property with that name, the WebPart then uses that property to display the title... kinda tricky

    Output

    enter image description here