Changing RadToolBarButton Text.

2 posts, 0 answers
  1. Richard
    Richard avatar
    1 posts
    Member since:
    Feb 2011

    Posted 18 Oct 2016 Link to this post


    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

  2. Peter Milchev
    Peter Milchev avatar
    657 posts

    Posted 21 Oct 2016 Link to this post

    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.

    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.
Back to Top