button column

2 posts, 0 answers
  1. Mateo
    Mateo avatar
    17 posts
    Member since:
    Aug 2007

    Posted 05 Sep 2007 Link to this post

    Couple of questions that i don't seem to find in the doc.

    1- I need to show a global button in the top of the datagrid to add a new row for example. How can i do this and trigger the new row event?

    2- I need to show a delete and update button for each row in the grid when edit mode is allowed.

    3- How can i get the object binded to a row in a datagrid (the this property).


  2. Jack
    Jack avatar
    2333 posts

    Posted 06 Sep 2007 Link to this post

    Hi Mateo,

    1. On your first question: The easiest solution is to put some button at the desired position on your form. You can also add a RadButtonElement to grid HeaderElement's children collection:

       RadButtonElement button = new RadButtonElement();
       button.Text = "Add new row";
       button.Click += new EventHandler(button_Click);

      In your button_Click event change the current row position:

      this.radGridView1.MasterGridViewInfo.TableAddNewRow.IsCurrent = true;

      As an alternative you can add new row by code:

      this.radGridView1.Rows.Add("John", "Smith", "555-232-435");

    2. Regarding the second question: This is not possible with the current version of RadGridView. We will add API for adding custom buttons in grid rows in one of our next versions
    3. To get the bound object to a row use the DataBoundItem property of GridViewRowInfo:

      object boundObject = this.radGridView1.Rows[3].DataBoundItem;

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top