问题
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