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

Is there a way to redisplay the Insert row after an insert?

2 Answers 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin Schlegelmilch
Top achievements
Rank 1
Kevin Schlegelmilch asked on 11 Dec 2008, 01:12 AM
I have this code in my RadGrid1_PreRender to display the Insert row when the page is displayed.  However, after I've clicked on the "Insert" on the row, the Insert row disappears.  I have to have the IsPostBack check because I have a dropdown that has a postpack event.

        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                // always display the insert link
                this.RadGrid1.MasterTableView.IsItemInserted = true;
                this.RadGrid1.MasterTableView.Rebind();
            }
        }

I've put the same code in the RadGrid1_InsertCommand and in the RadGrid1_ItemInserted events, but the Insert row does not reappear.

Anyone have any ideas how to keep the Insert row always displayed even after an Insert?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Dec 2008, 08:52 AM
Hello Kevin,

Please test this modification:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    if (!RadGrid1.MasterTableView.IsItemInserted) 
    { 
        RadGrid1.MasterTableView.IsItemInserted = true
        RadGrid1.Rebind(); 
    } 

Let me know whether this helps.

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kevin Schlegelmilch
Top achievements
Rank 1
answered on 11 Dec 2008, 05:48 PM
Yep, that worked perfectly ... don't ask me why I didn't think of that ... :)
Tags
Grid
Asked by
Kevin Schlegelmilch
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Kevin Schlegelmilch
Top achievements
Rank 1
Share this question
or