Dynamically code added columns require double tab to activate

3 posts, 0 answers
  1. Chris
    Chris avatar
    8 posts
    Member since:
    Jan 2011

    Posted 02 Jun 2014 Link to this post

    My Silverlight RadGridView requirement is such that I have a grid with a set number of columns that are defined at design time.  Then, depending on the data set that is loaded, I have to dynamically add N additional columns to the grid.  Each dynamic column needs to be unbound and have the ability have text entered.

    The approach I took was to define a DataTemplate as a page resource and then use the DataTemplate as a CellTemplate for each run-time created column.  The data template is defined simply as a <TextBox>.

    Everything loads and displays correctly.  The issue, however, is that when I tab through the grid and come to one of the dynamically added columns, I have to tab twice to be able to enter the data (once to gain focus on the column and again to gain focus on the textbox).  Then, sometimes when I tab out and then tab back over the cell to which I entered data, the data will be erased.

    What am I missing so that the grid behaves as it should, and expected?  That is, only have to tab once between cells to enter data in the dynamically added cell and then not loose any data?

  2. Chris
    Chris avatar
    8 posts
    Member since:
    Jan 2011

    Posted 02 Jun 2014 in reply to Chris Link to this post

    I've tried setting EditTriggers="CellClick" at the grid level but that still does not give me the desired outcome.  The cells in which I need the textbox controls are dynamically so I do not know how to set EditTriggers for the individual columns through code.
  3. DevCraft R3 2016 release webinar banner
  4. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 04 Jun 2014 Link to this post


    I tested defining some columns at design time like so:

    I still need to tab two times, so that I get the focus inside the TextBox defined as CellTemplate.
    You say that you need to Tab once between the initially defined columns - how have you defined the columns at design time?

    Generally, you can redefine how the GridView handles the "Tab" key (and other keys) creating your own custom keyboard provider. Please refer to our online documentation for further details. It also shows some sample code.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top