Add custom verbs into Web Part


Problem :I want to add some custom verbs for each of the web part i have. Along with Minimize, Close verbs i want to add Save, MyFavorite, Edit etc to the web part verb. And after clicking on that verbs lets say [Help] i need to do some server side processing.

Solution:
We can do like this. Here i’ll show you how to make our customized Help Verb.

First implement the IWebActionable interface in ur class or page.

public System.Web.UI.WebControls.WebParts.WebPartVerbCollection Verbs
{
get
{
WebPartVerb MyVerb = new WebPartVerb(“MyVerb”, new WebPartEventHandler(MyVerb));
MyVerb .Text = “Kailash D”;
MyVerb .ImageUrl = “~/Images/Me.ico”;
return new WebPartVerbCollection(new WebPartVerb[] { MyVerb });
}
}
private void Help(object sender, WebPartEventArgs e)
{
// Here you can add your server side code.
}

Happy Programming 🙂

Advertisements

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s