RadListView InsertItem question..

2 posts, 0 answers
  1. Carlo
    Carlo avatar
    6 posts
    Member since:
    Oct 2010

    Posted 08 Oct 2010 Link to this post

    Hi,

    Is there a way to make the RadListView InsertItem behave like the EditItem? What I mean is I use a list view with a pagesize of 1.
    When I use the Edit functionality, the EditItem replaces the current Item displayed (while editing). When I
    try to use the Insert functionality the InsertItem shows up either below or above my current Item displayed, I would like
    the InsertItem to replace the current Item displayed (while inserting), much like the edit item..

    Regards,
    -Carlo
  2. Dimo
    Admin
    Dimo avatar
    8396 posts

    Posted 14 Oct 2010 Link to this post

    Hello Carlo,

    You can achieve the desired behavior with 3 event handlers and a flag:

    protected bool IsInsertItem;
     
    protected void RadListView1_ItemCreated(object sender, RadListViewItemEventArgs e)
    {
        RadListView rlv = sender as RadListView;
        if (e.Item is RadListViewInsertItem)
        {
            IsInsertItem = true;
        }
    }
     
    protected void RadListView1_PreRender(object sender, EventArgs e)
    {
        if (IsInsertItem)
        {
            RadListView rlv = sender as RadListView;
            foreach (RadListViewDataItem item in rlv.Items)
            {
                item.Visible = false;
            }
        }
    }
     
    protected void RadListView1_ItemCommand(object sender, RadListViewCommandEventArgs e)
    {
        if (e.CommandName == "Cancel" || e.CommandName == "PerformInsert")
        {
            IsInsertItem = false;
            RadListView rlv = sender as RadListView;
            foreach (RadListViewDataItem item in rlv.Items)
            {
                item.Visible = true;
            }
        }
    }


    Kind regards,
    Dimo
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top