Sharepoint-在smartpart中自定义用户控件属性
如果有人知道如何自定义智能部件中的属性。我已经创建了用户控件并将其包装在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想要验证 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.
你确定这是正确的吗?
也许,您想要的是:
或者
无论如何,如果您只想将用户控件包装在 Web 部件中,则不需要 SmartPart。您可以非常轻松地自己编写自定义 Web 部件。
Are you sure this is correct?
Perhaps, what you want is:
or
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.