Sharepoint. How to access objects in RenderingTemplate

余生长醉 提交于 2019-12-14 04:09:30

问题


I'm working on rendering templates (Sharepoint 2010), overrided standart new/edit/display forms with my own, but I can't get objects in code-beghind from inside RenderingTemplate class. for e.g:

<SharePoint:RenderingTemplate ID="ParentItemsListView" runat="server">
<Template>
    <table cellpadding=0 cellspacing=0>
        <tr><td nowrap class="class1"><asp:Label ID="label1" runat="server" /></td></tr>
        <tr><td><SharePoint:FieldLabel runat="server" ID="TitleDescriptionField"  ControlMode="Edit" FieldName="Title" /></td></tr>
    </table>
</Template>

I need to custom FieldLabel object.

I hope someone could help me. Thanks.


回答1:


You should be able to get it like this:

FieldLabel fieldLabelControl= ParentItemsListView.FindControl("TitleDescriptionField") as FieldLabel;
if(fieldLabelControl != null)
{
  //Do something with it
}


来源:https://stackoverflow.com/questions/9060049/sharepoint-how-to-access-objects-in-renderingtemplate

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