SharePoint / ASP.Net Development
Experiences from the field...
Navigation
   RSS 2.0
Categories
Entries by Month

# Thursday, April 29, 2004

I was in the middle of answering a question on the message board at SharePointU and I thought it would make a good blog entry.

The WSS framework provides a mechanism (called tokens) to uniquely identify the HTML DOM elements of each part. When writing client-side script in a web part, you can use the token _WPQ_ to refer to the current web part. The poster in the forums is using the token to reference the WebPartCaption element:

            var wpc = WebPartCaption_WPQ_;

However, this is not working because the _WPQ_ token has been changed by WSS. Looking at the page source in IE will show WPQ1, WPQ2, etc. To get the script to work, we need to use the ReplaceTokens method of the WebPart object.

ReplaceTokens takes a string as input and returns the same string with all of the WebPart tokens converted in to their appropriate values. A list of the available tokens is included in the SDK page on ReplaceTokens().

I also posted a sample.

Thursday, April 29, 2004 8:44:19 AM (Central Daylight Time, UTC-05:00)  #    Comments [0]  | 
Comments are closed.
Search

Further Reading...

Powered by: newtelligence dasBlog 2.2.8279.16125

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008, Paul Schaeflein

Send mail to the author(s) E-mail