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

GridViewCommandColumn Edit Button Outside Of CommandCellClick

2 Answers 173 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kem
Top achievements
Rank 1
Kem asked on 30 Dec 2011, 02:05 AM
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 Answers, 1 is accepted

Sort by
0
Kem
Top achievements
Rank 1
answered on 30 Dec 2011, 06:05 PM
Hello

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

Thank You
0
Ivan Petrov
Telerik team
answered on 04 Jan 2012, 09:50 AM
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).
Tags
GridView
Asked by
Kem
Top achievements
Rank 1
Answers by
Kem
Top achievements
Rank 1
Ivan Petrov
Telerik team
Share this question
or