Override the list view web part menu

来源:互联网 发布:大成律师事务所知乎 编辑:程序博客网 时间:2024/05/20 04:10

Sometime we need to customize the menu of a list view web part to implement our own feature.

For example, dynamically change the script of new menu, update menu, etc.

What we shall do is to get the menu object and change its attribute "ClientOnClickScript" or "ClientOnClickNavigateUrl".

From Reflector, we can see the source code as follows:

 

 

In the set method, it will change the other one. That is to say, we can select either to get our feautre done.

Primary code is below:

 

The Microsoft doesn't suggest this way, but it isdynamic.

Hava a good time.