| Author |
Message |
Steve
Guest
|
Posted:
Sat Jan 15, 2005 7:29 am Post subject:
using ClassResourcePath in a custom toolpart |
|
|
Hi,
I am trying to use ClassResourcePath to get the path to a
javascript file in a custom toolpart. This is for a
webpart that I am writing.
I thought in the custom toolpart,
this.ParentToolPane.SelectedWebPart.ClassResourcePath will
get me the path. But I am getting a build error:
'Microsoft.SharePoint.WebPartPages.WebPart.ClassResourcePat
h' is inaccessible due to its protection level
Any ideas? Thanks. |
|
| Back to top |
|
 |
Mike Walsh
Guest
|
Posted:
Sat Jan 15, 2005 5:50 pm Post subject:
Re: using ClassResourcePath in a custom toolpart |
|
|
The new subnewsgroup for WSS programming
(microsoft.public.sharepoint.windowsservices.development) is the place to
ask this kind of question.
Apart from the fact that we're trying to keep more general questions and
programming questions separate, you'll also find there a collected bunch of
WSS programming experts (i.e. concentrated programming help).
So please post there. (and please don't copy to this newsgroup for the same
(keeping separate) reason.
(I appreciate that you probably didn't know about that newsgroup - it's well
hidden)
Mike Walsh, Helsinki, Finland
WSS FAQ at http://wss.collutions.com
Please reply to the newsgroup
"Steve" <anonymous@discussions.microsoft.com> wrote in message
news:134501c4faa1$b6ec3ab0$a401280a@phx.gbl...
| Quote: | Hi,
I am trying to use ClassResourcePath to get the path to a
javascript file in a custom toolpart. This is for a
webpart that I am writing.
I thought in the custom toolpart,
this.ParentToolPane.SelectedWebPart.ClassResourcePath will
get me the path. But I am getting a build error:
'Microsoft.SharePoint.WebPartPages.WebPart.ClassResourcePat
h' is inaccessible due to its protection level
Any ideas? Thanks.
|
|
|
| Back to top |
|
 |
Stephen Hewlett
Guest
|
Posted:
Mon Jan 17, 2005 6:15 pm Post subject:
Re: using ClassResourcePath in a custom toolpart |
|
|
The ClassResourcePath property is declared as "protected", meaning that it
can only be accessed from the webpart class itself or any classes derived
from it. The toolpart class is seperate from the webpart class, which is why
it can't access the property.
You could get round this by creating your own public method or property in
your webpart class which returns the ClassResourcePath value.You would then
have to use an expression such as [1] to access it from the toolpart; that
is you would have to cast the SelectedWebPart field to *your* webpart class
as the base webpart class (its default type) won't contain the custom method
or property.
Alternatively, you could do it the other way - create a public method or
property in your toolpart class, then pass the ClassResourcePath value into
it when your webpart creates the toolpart instance.
[1] :
((MyNamespace.MyWebPartClass)(this.ParentToolPane.SelectedWebPart)).MyClassResourcePath
"Steve" <anonymous@discussions.microsoft.com> wrote in message
news:134501c4faa1$b6ec3ab0$a401280a@phx.gbl...
| Quote: | Hi,
I am trying to use ClassResourcePath to get the path to a
javascript file in a custom toolpart. This is for a
webpart that I am writing.
I thought in the custom toolpart,
this.ParentToolPane.SelectedWebPart.ClassResourcePath will
get me the path. But I am getting a build error:
'Microsoft.SharePoint.WebPartPages.WebPart.ClassResourcePat
h' is inaccessible due to its protection level
Any ideas? Thanks.
|
|
|
| Back to top |
|
 |
Guest
|
Posted:
Sat Jan 22, 2005 12:21 am Post subject:
Re: using ClassResourcePath in a custom toolpart |
|
|
I usually just use the ReplaceTokens function with the _WPR_ token.
http://msdn.microsoft.com/library/en-us/spptsdk/html/smpmwebpartreplacetokens.asp
HTH,
<Todd />
"Steve" <anonymous@discussions.microsoft.com> wrote in message
news:134501c4faa1$b6ec3ab0$a401280a@phx.gbl...
| Quote: | Hi,
I am trying to use ClassResourcePath to get the path to a
javascript file in a custom toolpart. This is for a
webpart that I am writing.
I thought in the custom toolpart,
this.ParentToolPane.SelectedWebPart.ClassResourcePath will
get me the path. But I am getting a build error:
'Microsoft.SharePoint.WebPartPages.WebPart.ClassResourcePat
h' is inaccessible due to its protection level
Any ideas? Thanks.
|
|
|
| Back to top |
|
 |
|
|
|
|