Sharepoint-在smartpart中自定义用户控件属性

发布于 2024-08-17 07:45:07 字数 530 浏览 7 评论 0原文

如果有人知道如何自定义智能部件中的属性。我已经创建了用户控件并将其包装在 smartpart 中。我想从文档库上传我的 xml。

private string feedXML;
        [Browsable(true),
        Personalizable(true) ]


        public string FeedXML
        {
            get
            { return feedXML; }

            set
            { feedXML = value; }
        }

我用这个就像 //

feedXML="\customxml.xml";
    XPathDocument doc = new XPathDocument(Server.MapPath(feedXML));

但这东西不起作用。当我单击“修改共享点”页面的共享 Web 部件时,未呈现。任何我出错的地方的线索。

If anyone is having idea how to customize properties in a smartpart. I have created usercontrol and i m wrappin it in a smartpart.I want to upload my xml from Document library.

private string feedXML;
        [Browsable(true),
        Personalizable(true) ]


        public string FeedXML
        {
            get
            { return feedXML; }

            set
            { feedXML = value; }
        }

and I am using this like
//

feedXML="\customxml.xml";
    XPathDocument doc = new XPathDocument(Server.MapPath(feedXML));

but this thing is not working . When I am clicking on modify shared webpart of sharepoint page is not rendering. Any clue where I m getting wrong.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东北女汉子 2024-08-24 07:45:07

您可能想要验证 server.mappath 语句的结果。它将类似于 C:\Inetpub...
因此,您的代码尝试从真正存在于 SharePoint 中的文件系统中检索文件,因为您已将其上传到文档库。

如果您需要该文件,则必须使用 SharePoint 对象模型检索它,请查看 GetFileAsString 方法

我同意 Denni 的观点。

似乎 Smartpart 只会让事情变得更加困难?它有什么优点呢?

我为 ascx 控件制作了自己的 webpart 容器..只需很少的工作即可获得您需要的所有控制。信任设置也没有问题。

You might want to verify the result of your server.mappath statement. It will be something like C:\Inetpub...
So your code is trying to retrieve a file from the filesystem that really lives in SharePoint because you have uploaded it to a Document Library.

If you want that file you'll have to retrieve it using the SharePoint object model, have a look at the GetFileAsString method.

I agree with Denni..

Seems like Smartpart is only making it more difficult? What advantages does it have?

I make my own webpart containers for ascx controls.. very little work and all the control you need. No problems with trust settings either.

离不开的别离 2024-08-24 07:45:07

你确定这是正确的吗?

feedXML="\customxml.xml";

也许,您想要的是:

feedXML="\\customxml.xml"; //escape the back-slash.

或者

feedXML="/customxml.xml"; // use the forward-slash.

无论如何,如果您只想将用户控件包装在 Web 部件中,则不需要 SmartPart。您可以非常轻松地自己编写自定义 Web 部件。

Are you sure this is correct?

feedXML="\customxml.xml";

Perhaps, what you want is:

feedXML="\\customxml.xml"; //escape the back-slash.

or

feedXML="/customxml.xml"; // use the forward-slash.

Anyway, if you just want to wrap your user control inside a Web part, you don't need the SmartPart. You can write your custom Web part yourself quite easily.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文