开发者

Sharepoint-customizing usercontrol property in smartpart

开发者 https://www.devze.com 2022-12-16 05:22 出处:网络
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.

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;
开发者_StackOverflow中文版        [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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消