Edit Cell Event

9 posts, 0 answers
  1. Devon
    Devon avatar
    11 posts
    Member since:
    Jun 2008

    Posted 19 Feb 2009 Link to this post

    Hi,
    I've been trying to figure out how to edit cells in the grid.  I need to be able to edit a cell in the grid, and get the cells New value, it's old value, and the column that the cell is in.  I've been trying unsuccessfully to get an event to work.  I've tried many of the grids events, but none fire when I need them to.

    I have tried to use the grid.CellInEditMode.EditEnded event, however, it says that CellInEditMode is Null, which makes sense, because I'm trying to make the event in the pageInitialization function, and there is nothing in the grid yet. 

    How would I go about getting the edited cells data?

    Also, I'm wondering, do you have a release date for Q1 2009?  The product we are building is also scheduled to be released Q1 2009, and it will pretty much coincide with your release date.

    Thanks
  2. Devon
    Devon avatar
    11 posts
    Member since:
    Jun 2008

    Posted 19 Feb 2009 Link to this post

    Also, I'm having trouble changing the header name. 

    right now I'm trying :  grid.Columns[0].HeaderText = "TEST";

    and I have also tried grid.Columns["ColumnName"].HeaderText = "TEST";

    neither of these seem to work, any suggestions?

    Also, I can't seem to make a column invisible.  Whenever I do, I get an error during runtime.  The grid loads, and the column that I don't want to show, is hidden, but then error messages pop up, and the whole thing crashes.

    Thanks.
  3. DevCraft banner
  4. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 23 Feb 2009 Link to this post

    Hi Devon,

    Please, find attached a simple application that demonstrates how to handle the GridViewCell.EditEnded event. It also shows how to hide a grid column runtime. Please, let me know if the code works for you.

    Regarding the setting the header text of grid columns: the currently available version of RadGridView has a bug which prevents the headers from properly updating their UI when the developer changes the HeaderText property of a column. We have this problem logged for fixing, we will try to include a fix in the upcoming major release Q1 2009 in a couple of weeks.

    All the best,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Devon
    Devon avatar
    11 posts
    Member since:
    Jun 2008

    Posted 23 Feb 2009 Link to this post

    thanks for the example it's exactly what I needed.  I'm now wondering if the Q1 release will be able to tell me the column header that the edited cell is under, or is there a way to get it with the current release? 

    Right now, all I see is "" for the column name, is there somthing I must do to get the column name?

    Thanks
  6. Devon
    Devon avatar
    11 posts
    Member since:
    Jun 2008

    Posted 23 Feb 2009 Link to this post

    Also, I just tried out the Column.isvisible = false, and it crashes my internet explorer.  I am building my grid with a List <ContainerClass> from a database query, so maybe it is able to make the columns invisible if the data is hardcoded, but not if it is dynamically loaded.

  7. Jordan
    Admin
    Jordan avatar
    123 posts

    Posted 27 Feb 2009 Link to this post

    Hi Devon,

    First for the column header: You can get GridViewColumn object from DataColumn property of GridViewCell, and you can use its UniqueName and HeaderText properties.
    public void OnEditEnded(object sender, CellRoutedEventArgs args) 
      GridViewCell cell = (GridViewCell)args.OriginalSource; 
      cell.DataColumn.UniqueName 
      cell.DataColumn.HeaderText 

    Unfortunately I can't reproduce the issue with internet explorer crash when try to hide column. Can you send a sample project that demonstrates the issue to test it locally?

    Thanks for the feedback.

    Kind regards,
    Jordan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Devon
    Devon avatar
    11 posts
    Member since:
    Jun 2008

    Posted 27 Feb 2009 Link to this post

    Ok I found out what causes the error.  If you remove a column automatically in the code, it will remove the header without any problems.

    However when I added a button, and in the button.Clicked event I made the grid reload with some new data, and the column invisible, it then crashed.
  9. Devon
    Devon avatar
    11 posts
    Member since:
    Jun 2008

    Posted 27 Feb 2009 Link to this post

    I'm not sure how to upload the project though. 
  10. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 02 Mar 2009 Link to this post

    Hello Devon,

    To upload a project you need to open a support ticket first. To do this you have to log in to your account and go to the following link:
    http://www.telerik.com/account/support-tickets/write-support-ticket.aspx?productID=602

    Then you will have the option to attach files(see the attached screenshot).

    Hope this helps.

    Regards,
    Rosi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
DevCraft banner