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

Changing RadToolBarButton Text.

1 Answer 101 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 18 Oct 2016, 03:08 PM

Hi,

I have a RadGrid with a CommandItemTemplate.In the InstantiateIn I define a toolbar and add two buttons.

After clicking the button I do a Rebind of the grid in the ItemCommand-event of the grid and I change the text of the clicked button. This fires also the InstantiateIn event of the CommandItemTemplate, so the text of the button is reset.

If I store the text in a property and want to acces this one I get the error:

Cannot access non-static field in static context

I have a kind of sollution with going to the parent of the container like ( container.Parent.Parent.Parent ect) to approach the property. But is there a better approach to change the text of the buttons after clicking them. And I cannot do this client side.

regards, Richard

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 21 Oct 2016, 02:07 PM
Hello Richard,

Would you please verify that you are creating the Grid structure during Page_Init as demonstrated in the Creating Template Columns Programmatically article. 

Alternatively, you can keep the built-in command item and add any new button or other controls using the ItemCreated event handler. 

If you have different requirements or need further instructions, please modify the attached Web Site Sample to demonstrate your specific configuration and send it back to us for further investigation.

Thus, we would be able to investigate your exact scenario locally and help you more efficiently.

Regards,
Peter Milchev
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
ToolBar
Asked by
Richard
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or