Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Sharepoint Custom Rendering Template - Register prefix problem -Form is empty

$
0
0

Hello,

I have a problem with create custom rendering template with custom SaveButton.

Below code from CustomListTemplate

If I just cut this prefix it working but I can't change orginal SaveButton, else form is just empty.


<%@ Register TagPrefix="MTDFaxLogSaveButton" Namespace="SEZZCustomUserControls" Assembly="SEZZCustomUserControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<MTDFaxLogSaveButton:FaxLogSaveButton ID="SaveButton1" runat="server"/>

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %><%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %><%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Control Language="C#" AutoEventWireup="false" %><%@ Register TagPrefix="wssuc" TagName="ToolBar" Src="~/_controltemplates/ToolBar.ascx"%><%@ Register TagPrefix="wssuc" TagName="ToolBarButton" Src="~/_controltemplates/ToolBarButton.ascx" %><%@ Register TagPrefix="MTDFaxLogSaveButton" Namespace="SEZZCustomUserControls" Assembly="SEZZCustomUserControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%><SharePoint:RenderingTemplate id="CustomListForm" runat="server"><Template><span id='part1'><SharePoint:InformationBar ID="InformationBar1" runat="server"/><div id="listFormToolBarTop"><wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbltop" RightButtonSeparator="&amp;#160;" runat="server"><Template_RightButtons><SharePoint:NextPageButton ID="NextPageButton1" runat="server"/><MTDFaxLogSaveButton:FaxLogSaveButton ID="SaveButton1" runat="server"/><SharePoint:GoBackButton ID="GoBackButton1" runat="server"/></Template_RightButtons></wssuc:ToolBar></div><SharePoint:FormToolBar ID="FormToolBar1" runat="server"/><SharePoint:ItemValidationFailedMessage ID="ItemValidationFailedMessage1" runat="server"/><table class="ms-formtable" style="margin-" border="0" cellpadding="0" cellspacing="0" width="100%"><SharePoint:ChangeContentType ID="ChangeContentType1" runat="server"/><SharePoint:FolderFormFields ID="FolderFormFields1" runat="server"/><SharePoint:ListFieldIterator ID="ListFieldIterator1" runat="server"/><SharePoint:ApprovalStatus ID="ApprovalStatus1" runat="server"/><SharePoint:FormComponent ID="FormComponent1" TemplateName="AttachmentRows" runat="server"/></table><table cellpadding="0" cellspacing="0" width="100%"><tr><td class="ms-formline"><img src="/_layouts/images/blank.gif" width='1' height='1' alt="" /></td></tr></table><table cellpadding="0" cellspacing="0" width="100%" style="padding-><tr><td width="100%"><SharePoint:ItemHiddenVersion ID="ItemHiddenVersion1" runat="server"/><SharePoint:ParentInformationField ID="ParentInformationField1" runat="server"/><SharePoint:InitContentType ID="InitContentType1" runat="server"/><wssuc:ToolBar CssClass="ms-formtoolbar" id="toolBarTbl" RightButtonSeparator="&amp;#160;" runat="server"><Template_Buttons><SharePoint:CreatedModifiedInfo ID="CreatedModifiedInfo1" runat="server"/></Template_Buttons><Template_RightButtons><MTDFaxLogSaveButton:FaxLogSaveButton ID="SaveButton2" runat="server"/><SharePoint:GoBackButton ID="GoBackButton2" runat="server"/></Template_RightButtons></wssuc:ToolBar></td></tr></table></span><SharePoint:AttachmentUpload runat="server"/></Template></SharePoint:RenderingTemplate>

I create custom contenttype code below:

<?xml version="1.0" encoding="utf-8"?><Elements xmlns="http://schemas.microsoft.com/sharepoint/"><!-- Parent ContentType: Element (0x01) --><ContentType ID="0x01007850419b9a5a44a4aee972ff8c6e68e4"
               Name="SEZZCustomUserControls - ContentType2"
               Group="Custom Content Types"
               Description="My Content Type"
               Overwrite="TRUE"
               Inherits="FALSE"
               Version="0"><FieldRefs></FieldRefs><XmlDocuments><XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"><FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms"><Display>ListForm</Display><Edit>ListForm</Edit><New>CustomListForm</New></FormTemplates></XmlDocument></XmlDocuments></ContentType></Elements>

And the end FaxLogSaveButton its simply code for the tests .

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace SEZZCustomUserControls

{ 
public class FaxLogSaveButton : SaveButton


{ 
protected override bool SaveItem()


{ 
bool success = base.SaveItem(); 
//Dont forget to remove the source querystring parameter from the NewForm.aspx URL, otherwise this setting will not work.


RedirectUrl = String.Concat(List.ParentWeb.ServerRelativeUrl, "/", List.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url, @"?ID=", ListItem.ID, @"&Source=", ListItem.ParentList.DefaultViewUrl); 
return success;


}


}


}

Whats wrong with this codes , I deploy it with no errors but form is empty when I back to orginal ListForm but with change rendering template name its ok when I put my prefix and change savebutton it's not working ?

Please help :)


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>