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

[Solved] RadGrid Refresh button Event

2 Answers 1082 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg Smith
Top achievements
Rank 1
Greg Smith asked on 09 Oct 2009, 07:29 PM
I need to to a Rebind() when the Page is refreshed, but not when a new record is first inserted (I lose all of the "new" values if I do). What can I check on in order to perform the Rebind?

Particularly when the user clicks the "Refesh" button on the Grid.


Thanks
Greg

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Oct 2009, 05:34 AM
Hello Greg,

You can check for the CommandName of the Refresh button in the ItemCommand event of the grid. The example below should help restore the inserted values when Refresh button is clicked.
c#:
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    { 
        if (e.CommandName == RadGrid.RebindGridCommandName) 
        { 
            if (RadGrid1.MasterTableView.IsItemInserted) 
            { 
                e.Canceled = true
            } 
        }        
    } 

Thanks
Princy.
0
Greg Smith
Top achievements
Rank 1
answered on 13 Oct 2009, 03:53 PM
Hi Princy,

The e.CommandName is "Rebind" the RadGrid.RebindGridCommandName is "RebindGrid" and the code does not going into the if() block. Did a hard comparison against "Rebind" and it works.

I ended up with this:

if (e.CommandName == "Rebind")
{
     this.radGrid.Rebind();
}


Greg
Tags
Grid
Asked by
Greg Smith
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Greg Smith
Top achievements
Rank 1
Share this question
or