RSS 2.0 Feed
2008-08 Entries
摘要:这个估计是最常用的.net工具,Lutz Roeder同学终于把它转交给Red Gate Software去开发了……这个东西居然有8年多了。 After more than eight years of working on .NET Reflector, I have decided it is time to move on and explore some new opportunities. I have reached an agreement to have Red Gate Software continue the development of .NET Reflector. Red Gate has a lot of experience creating development tools for both .NET and SQL Server. They have the resources necessary to work on new features, and Reflector fits nicely with other .NET tools the company offers. Red Gate will continue to provide the free community version and is looking for your feedback......[阅读全文]

posted @ | Feedback (0) | Filed Under [ C#/ASP.Net ]

摘要:最近有个需求,将不同的内容类型组织到同一个列表(不是文档库)中,希望能够给不同的内容类型显示不同的图标。不过SharePoint内容类型似乎没有关于图标的设置,翻了ContentType的SchemaXml和若干个xml配置文件都没找到相关的办法。 今天突然想到了计算字段,猜测大概能做到这一点,不过计算字段只能显示单行文本、数值、是/否等几种固定类型,不能显示html内容,我觉得可以通过修改默认的计算字段配置文件来达到这一目的。上网搜了一下,果然找到:Enabling HTML and/or Images in a SharePoint List using a calculated field 大致的方法就是控制计算字段在显示的时候的html编码,在FLDTYPES.XML中我们可以看到默认是这个样子的: 1 <Default> 2 <Column HTMLEncode="TRUE" AutoHyperLink="TRUE" AutoNewLine="TRUE"/> 3 </Default> 也就是说对于单行文本的显示方式,都是加上了HTML编码的,自然我们可以改掉这个地方,但是为了不影响其他计算字段的显示,可以用一些特定标记来判断,比如改成这样: 1 <IfSubString> 2 <Expr1><![CDATA[<custom/>]]></Expr1> 3 <Expr2><Column/></Expr2> 4 <Then> 5 <HTML><Column/></HTML> 6 </Then> 7 <Else> 8 <Column HTMLEncode="TRUE" AutoHyperLink="TRUE" AutoNewLine="TRUE"/> 9 ......[阅读全文]

posted @ | Feedback (0) | Filed Under [ SharePoint ]

摘要:这里的表单指的是列表默认的新建界面和编辑界面,在点击“确定”之后实际上是可以触发一段我们自定义的代码的,比如跳转页面、做一些其他操作等事情。(虽然跳转页面可以通过url中的Source来做,但是我们往往需要跳转时url加上当前列表条目的ID,不过新建页面中是拿不到条目ID的……) 添加表单事件的方法很容易,不过没有见到网上有任何文章说这件事 -.- 在SPFormContext中使用OnSaveHandler属性就可以挂载一个EventHandler了,所以我们可以在表单页面中加入如下代码(通过WebPart或者自定义字段): 1 protected override void OnInit(EventArgs e) 2 { 3 base.OnInit(e); 4 // add save handler 5 if (SPContext.Current.FormContext.FormMode == SPControlMode.New) 6 SPContext.Current.FormContext.OnSaveHandler += new EventHandler(MyHandler); 7 } 通过Reflector,我们可以看到保存列表条目的那个确定按钮“SaveButton”在保存时所做的操作,如果当前表单中有SaveHandler的话,则不会自动保存该条目。换句话说,我们需要在代码里面自动做这件事,不过也很容易,利用SaveButton的静态方法SaveItem: 1 protected void MyHandler(object sender, EventArgs e) 2 { 3 string checkInComment = Page.Request.QueryString["CheckInComment"]; 4 if (checkInComment == null) checkInComment = ""; 5 SaveButton.SaveItem(SPContext.Current, false, checkInComment); 6 ......[阅读全文]

posted @ | Feedback (0) | Filed Under [ SharePoint ]