GridViewCommandColumn Edit Button Outside Of CommandCellClick

3 posts, 0 answers
  1. Kem
    Kem avatar
    14 posts
    Member since:
    Oct 2010

    Posted 29 Dec 2011 Link to this post

    Hello

    I clearly understand how to use the event associated with a CommandColumn click event (GridView_CommandCellClick). What I would like to do is gain access to the button's properties (GridViewCommandColumn Button) from another method. For example, if i have this method: "private void ChangeButtonText(GridViewRowInfo rowIndex, String buttonText)". This method is not associated with the click event of a CommandButton but this method needs to access CommandButton's properties for the given rowIndex and change the CommandButton.Text property equal to buttonText.

    I am using VS 2010, C# and Q2 update.

    Any help would be appreciated.

    Thank You
  2. Kem
    Kem avatar
    14 posts
    Member since:
    Oct 2010

    Posted 30 Dec 2011 Link to this post

    Hello

    I am using VS 2010, C# and Q2 update.

    Thank You
  3. Ivan Petrov
    Admin
    Ivan Petrov avatar
    705 posts

    Posted 04 Jan 2012 Link to this post

    Hi Kem,

    Thank you for writing.

    Please, find attached an example project which demonstrates how to achieve this scenario. There is a RadGridView with a command column in which each button text is "Command". There is also a button which changes the text of the buttons found on even row index to "Other". This is achieved through setting the Tag property of the cell to a given value ("Other" in this case) and then in the CellFormatting event of the RadGridView the Tag property is read and its value is applied as text of the command button.

    For additional information about formatting cells, please refer to this article.

    I hope this will be useful for you. If you need further assistance, I would be glad to provide it.

    Regards,
    Ivan Petrov
    the Telerik team

    SP1
    of Q3’11 of RadControls for WinForms is available for download (see what's new).
Back to Top