Is there a good reference SharePoint's databinding syntax?

丶灬走出姿态 提交于 2019-12-06 01:42:58

问题


I'm putting asp server-controls into my SharePoint XSLT using SharePoint Designer. I've found it's really handy for pre-populating values into the form, or providing a different experience than the SharePoint defined layout (hidden fields, etc).

For example, I can use a asp:TextBox control instead of the SharePoint:FormField control if I define it as such:

<xsl:stylesheet ... xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
   <xsl:param name="Name" />

   <xsl:template match="/">
       <!-- omitted for clarity -->

       <asp:TextBox id="txtName" runat="server" Text="{$Name}"
         __designer:bind="{ddwrt:DataBind('i','txtName','Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@MySharePointField')}"

   </xsl:template>
</xsl:stylesheet>

I've googled but can't seem to find a good reference for the parameters for ddwrt:DataBind method.

Does anybody know?


回答1:


The ddwrt:DataBind method is a wrapper for DataFormWebPart.AddDataBinding

The mysterious first parameter refers to the "operation". It will either be "i" (insert), "u" (update), or "d" (delete). Sadly, these are literal values because the XSLT doesn't have access to enumerations, etc.

The other curious fields are the propertyName and eventName, which are members of the control you're binding. The event is wired up using reflection to the sharepoint form, and the property is used to retrieve the value.

The remaining fields refer to the primary key and value to bind.

Full details on the method signature and how to use it can be found here



来源:https://stackoverflow.com/questions/1358034/is-there-a-good-reference-sharepoints-databinding-syntax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!