惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
N
Netflix TechBlog - Medium
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
B
Blog
F
Fortinet All Blogs
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
Google Developers Blog
A
About on SuperTechFans
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
B
Blog RSS Feed

博客园 - joe

通过70-542 在sharepoint中利用文档库扩展新闻应用(引用) 屏蔽“网站操作”菜单 图片库不能以缩略图方式显示的原因 - joe - 博客园 一个文档库权限控制的eventhandler 新建文件夹的时候自动按照文档库模板生成子文件夹和文件的解决代码 在SSP中通过ldap方式导入用户信息 form认证搜索不了的解决办法 form认证让“记住我”自动勾上 - joe - 博客园 安装MOSS的账号问题 Excel Calculation Services 无法启动的原因 sharepoint域认证的时候给用户一个友好的登陆界面 实现sharepoint 内容编辑器直接上传图片功能 sharepoint2007单点登陆问题 用户信息不同步的问题 在其他应用程序上传文件到MOSS文档库的例子 此网页的安全性验证无效并且可能损坏的错误的解决方法 找到表中某一列值相同的记录,而且只要其中一条记录的sql 三、设计一个K2.net2003的工作流程
wss2 如何在页面上显示登陆的用户名
joe · 2007-10-19 · via 博客园 - joe

This is one of my favorites.  I want my site to say, “Hello, John Jansen, welcome to this site“ or whatever.  But since you can't author server-side code with SharePoint sites, there is no evident way to do this.  The way I get around this limitation is to code XSLT and make it do what I want.

1. Insert a Data View Web Part based on the Announcements list
2. Click on Data > Conditional Formatting
3. Select any data value and Click on Create
4. Click on Show Content
5. Create a Condition that says: Title EQUALS [Current User] and click OK back to the Design view
6. Type “Hello, welcome to this site“ inside one of the Table cells
7. Switch to Code view
8. Find the following code:
<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
9. Change this code to this:
<ParameterBinding Name="UserID" Location="CAMLVariable;ServerVariable(LOGON_USER)" DefaultValue="CurrentUserName"/>
10. Scroll up in the code and find “Hello, welcome to this site”
11. Change this code to say this:
“Hello, <xsl:value-of select="$UserID"/> welcome to this site”
12. Save the page

Interesting notes:

First, you will see the user name repeat for each value in the Data View, so you should change the display using Data..Style so that it only shows One record.

Second, the ServerVariable() can be any of the server variables as documented on MSDN.

Third, the reason we created the Conditional Formatting in steps 2 - 5 was to make sure $UserID would be in scope.

Hope this works for ya!

-John