Welcome to the navigation

Amet, ex magna cillum dolor nisi culpa incididunt ullamco in minim officia consequat, in mollit ad exercitation aliquip quis commodo irure fugiat qui aute consectetur. Adipisicing pariatur, ex consectetur ad sit nisi et elit, eu occaecat excepteur quis cupidatat aliquip consequat, dolore ut anim lorem nulla esse in ipsum labore

Yeah, this will be replaced... But please enjoy the search!

How to set a webpart title and description programmatically

Categories Tags
Suppose the headline says it all, here is the code to set the name and description of a webpart programmatically in vb.net. Just a little snippet
Public Class MyWebPart
    Inherits Microsoft.SharePoint.WebPartPages.WebPart

    ' Method to set WebPart title and description
    ' By Bendsoft 2010
    Public Sub WebPartTitleDesc(ByVal title As String, ByVal desc As String)
        Me.Title = title
        Me.Description = desc
        Try
            Me.SaveProperties = True
        Catch ex As Exception
            Me.Controls.Add(New System.Web.UI.LiteralControl(ex.Message))
        End Try
    End Sub

    Protected Overrides Sub CreateChildControls()

        ' Set the Name of the web part
        Me.WebPartTitleDesc("MyWebPart List Name", "MyWebPart Description")

    End Sub
End Class
No magic really, just make sure to call the method WebPartTitleDesc from the CreateChildControls
Please note that this portal is a BETA site , I will continuously improve all functionality and performance during the coming weeks / the author