如何制作链接以打开 webpart 中的工具部件 [英] How to make a link to open to a toolpart in webpart

查看:48
本文介绍了如何制作链接以打开 webpart 中的工具部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的 webpart,当它第一次呈现时,我想提供链接以打开修改共享的 webpart 属性,就像我们在打开 OOB webparts(如内容编辑器或 XML webpart)时通常得到的那样?任何人都对此有想法......我正在使用它但是当我点击它时,它显示以下错误

我正在使用这个:

LiteralControl lctrl = new LiteralControl();lctrl.Text=string.Format("<a id='MsoFrameworkToolpartDefmsg_{0}' href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit','129','{0}');\">打开工具窗格</a> 并输入有效值.",this.ID);Controls.Add(lctrl);

错误:您尝试更改的 Web 部件无效或已被其他用户删除.单击以刷新它.(显示在我的工具窗格中)

解决方案

取自一个工作 webpart:

myvar = "打开工具面板"

ID"是 Web 部件 ID.我使用 UserControl 来保存我的 WebPart 代码,所以我使用 Parent.ID

I have a custom webpart and when it first renders I want to give link to open modify shared webpart properties as we generally get when we open OOB webparts like Content editor or XML webpart? Any one is having idea on this ...I was using this but when I m clicking on it, its showing following error

I m using this:

LiteralControl lctrl = new LiteralControl();
lctrl.Text=string.Format("<a id='MsoFrameworkToolpartDefmsg_{0}' href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit','129','{0}');\">Open the tool pane</a> and enter a valid value.",this.ID);
Controls.Add(lctrl);

ERROR: A Web Part you attempted to change is either invalid or has been removed by another user.Click to refresh it.(This its showing in my toolpane)

解决方案

Taken from a working webpart:

myvar = "<a href=\"javascript:MSOTlPn_ShowToolPane2Wrapper('Edit', this, '" + ID + "')\">Open the toolpanel</a>"

"ID" is the webpart ID. I use a UserControl to hold my WebPart code, so I use Parent.ID

这篇关于如何制作链接以打开 webpart 中的工具部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆