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

firing grid event by clicking custom button

3 Answers 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Maor
Top achievements
Rank 1
Maor asked on 28 Jan 2013, 11:44 AM
hello
i want to create an custom button on page that by clicking it, the radgrid will update all records.
i have already button inside grid called "UpdateAll" and i want to fire this button. my grid is always in edit mode.
how can i do this?

3 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Jan 2013, 12:24 PM
Hello,

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
  {
      if (e.CommandName == "UpdateAll")
      {
 
      }
  }
  protected void Button1_Click(object sender, EventArgs e)
  {
      RadGrid1.MasterTableView.Items[0].FireCommandEvent("UpdateAll","");
  }


Thanks,
Jayesh Goyani
0
Princy
Top achievements
Rank 2
answered on 28 Jan 2013, 12:25 PM
Hi,

I guess you want to call 'UpdateAll' command on an external button click.

C#:
protected void Button1_Click(object sender, EventArgs e)
{
    RadGrid grid = (this.FindControl("RadGrid1") as RadGrid);
    if (grid.EditItems.Count > 0)
    {         
        grid.EditItems[0].FireCommandEvent("UpdateAll", string.Empty);
    }
}

Thanks,
Princy.
0
Maor
Top achievements
Rank 1
answered on 28 Jan 2013, 12:39 PM
thanks guys
it works
Tags
Grid
Asked by
Maor
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Maor
Top achievements
Rank 1
Share this question
or