WebPartVerbs always postback

B

Brian

I would like to create a custom webpart verb that only calls client side
javascript. I created a custom WebpartVerb and added it to my zone's
collection via the following code:

ArrayList Arr = new ArrayList();
WebPartVerb v = new WebPartVerb("v1", "OnVerbClicked('" + this.ClientID +
"')");
v.Text = "Click me";
v.ImageUrl = "~/Images/down-b.gif";
Arr.Add(v);
e.Verbs = new WebPartVerbCollection(Arr);

(I am using the constructor which does not specify a server side method.)
The problem is that when this verb is rendered out to the client the anchor
tag has a __dopostback in the href field, like so:

<a onclick="OnVerbClicked('zone3');" href="javascript:__doPostBack('','')">

So after the client script is called an unnecessary postback is called.
Does anyone know how to prevent the href attribute from being rendered out?
The Verb control does not expose any properties which could help out.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,129
Messages
2,570,770
Members
47,329
Latest member
FidelRauch

Latest Threads

Top