This is a migrated thread and some comments may be shown as answers.

Issue due to fix on Q2 release: Fixed: Setting InsertItemPosition should not show the insert item

3 Answers 46 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Ben Grossman
Top achievements
Rank 1
Ben Grossman asked on 06 Dec 2011, 06:09 PM
Hello,
I noticed this change here: http://www.telerik.com/products/aspnet-ajax/whats-new/release-history/q2-2011-version-2011-2-712.aspx

We were previously using this property so that our insert item would show at all times.  In this case, our RadListView should have the InsertItemTemplate exposed at all times but after upgrading from the Q1 to Q2 release, the fix which disables this behavior in Q2 changes the way the ListView control performs.  What is the recommended way to always show the InsertItemTemplate?  We have several pages which are using several instances of the RadListView control, all of which we want the InsertItem available at all times.

Thanks,
Ben

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 08 Dec 2011, 10:47 AM
Hi Ben,

The recommended approach is to always check if RadListView.InsertItem is null and then call ShowInsertItem(), for example in PreRender:

protected void Page_PreRender(object sender, EventArgs e)
{
    if (RadListView1.InsertItem == null)
    {
        RadListView1.ShowInsertItem();
    }
}

Veli
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Peter
Top achievements
Rank 1
answered on 15 May 2012, 09:07 AM
This doesn't work for me - the InsertItemTemplate is never shown. What am I missing?

<telerik:RadListView runat="server" ID="lvSuspend" ItemPlaceholderID="CustomersContainer"
    AllowMultiItemEdit="true" InsertItemPosition="LastItem"
    onprerender="lvSuspend_PreRender">
    <LayoutTemplate>       
        LAYOUT
        <asp:PlaceHolder ID="CustomersContainer" runat="server" />
    </LayoutTemplate>
    <EmptyDataTemplate>
        EMPTY
    </EmptyDataTemplate>
    <ItemTemplate>
      ITEM     
    </ItemTemplate>
    <InsertItemTemplate>
        INSERT
    </InsertItemTemplate>  
</telerik:RadListView>
0
Peter
Top achievements
Rank 1
answered on 15 May 2012, 09:23 AM
The answer is binding to null. There seems to be difference with the Telerik List View and the ASP one wrt Insert/Empty template.

When binding to null/empty collection using DataBind():

ASP:
  • Shows Layout Template
  • Show Insert Template
  • Doesn't show Empty Template

Telerik:
  • Shows Empty template only

The Insert Item will only appear for the Telerik List View when binding to an empty collection with above Pre_Render code.

Tags
ListView
Asked by
Ben Grossman
Top achievements
Rank 1
Answers by
Veli
Telerik team
Peter
Top achievements
Rank 1
Share this question
or