Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > CMSEditModeButtonAdd in Transformation View modes: 
User avatar
Member
Member
snk1324 - 4/15/2011 10:11:58 AM
   
CMSEditModeButtonAdd in Transformation
I have a rather complicated transformation that has several child repeaters. For each of these child repeaters, I have the ShowEditDeleteButtons set to true. I would also like to add a Add New button for each of these.

I had thought I could use the CMSEditModeButtonAdd class, but it is not showing up. can this be done? If so, how? Is there a better way?

Basically I want to allow the user to add/edit/delete on the page for items in child repeaters in the transformation.

User avatar
Member
Member
snk1324 - 4/15/2011 2:28:52 PM
   
RE:CMSEditModeButtonAdd in Transformation
Ok, I was able to make this work a slightly different way. For the transformation for each of the repeaters that I want Add New functionality, I have the following:


<asp:Literal ID="litHeader" runat="server"/>
<li><%# Eval("SomeFieldName") %></li>
<script runat="server">
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (this.Parent is IDataItemContainer)
{
IDataItemContainer cont = this.Parent as IDataItemContainer;
if (cont != null)
{
System.Data.DataRowView drv = (System.Data.DataRowView)cont.DataItem as System.Data.DataRowView;
if (drv != null)
{
if (DataItemIndex == 0) {
if (CMSContext.ViewMode != ViewModeEnum.LiveSite && CMSContext.CurrentUser.IsAuthorizedPerClassName("My.ClassName", "Create")) {
litHeader.Text = "<h3><a class='CMSEditModeButtonAdd' href='/CMSModules/Content/CMSDesk/Edit/EditFrameset.aspx?action=new&nodeid=" + Eval("NodeParentID") + "&classid=" + Eval("NodeClassID") + "'>Add New</a> List Heading Here</h3><ul>";
}
else {
litHeader.Text = "<h3>List Heading Here</h3><ul>";
}
}
else {
litHeader.Visible = false;
}
}
}
}
}
</script>