Note that there are some explanatory texts on larger screens.

plurals
  1. POListview grouptemplate - code behind
    primarykey
    data
    text
    <p>I am looking to programatically load the group template and layout template but I am getting the following error message:</p> <p><strong>A group placeholder must be specified on ListView 'Listview1' when the GroupTemplate is defined. Specify a group placeholder by setting its ID property to "ListView_GC$groupPlaceHolder1". The group placeholder control must also specify runat="server".</strong></p> <pre><code> protected void Listview1_Init(object sender, EventArgs e) { System.Diagnostics.Debug.WriteLine("in init"); Listview1.ItemPlaceholderID = "ListView_UC$itemPlaceHolder1"; Listview1.GroupPlaceholderID = "ListView_GC$groupPlaceHolder1"; Listview1.GroupItemCount = 3; Listview1.LayoutTemplate = LoadTemplate("~/Controls/ThumbnailView_LayoutTemplate.ascx"); Listview1.GroupTemplate = LoadTemplate("~/Controls/ThumbnailView_GroupTemplate.ascx"); Listview1.ItemTemplate = LoadTemplate("~/Controls/ThumbnailView_ItemTemplate.ascx"); } void Listview1_LayoutCreated(object sender, EventArgs e) { Listview1.Controls.RemoveAt(0); Control newLayoutContainer = new Control(); Listview1.LayoutTemplate.InstantiateIn(newLayoutContainer); Listview1.GroupTemplate.InstantiateIn(newLayoutContainer); var userControl = newLayoutContainer.Controls[0]; var usergControl = newLayoutContainer.Controls[1]; userControl.ID = "ListView_UC"; usergControl.ID = "ListView_GC"; Listview1.Controls.Add(newLayoutContainer); } </code></pre> <p>Can anyone help?</p> <p>EDIT:</p> <p>Markup for the control...</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ThumbnailView_GroupTemplate.ascx.cs" Inherits="myproject.Controls.ThumbnailView_GroupTemplate" %&gt; &lt;tr&gt; &lt;asp:PlaceHolder ID="itemPlaceHolder1" runat="server" /&gt; &lt;/tr&gt; &lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ThumbnailView_LayoutTemplate.ascx.cs" Inherits="myproject.Controls.ThumbnailView_LayoutTemplate" %&gt; &lt;table&gt; &lt;asp:PlaceHolder ID="groupPlaceHolder1" runat="server" /&gt; &lt;/table&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload