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

Edit Cell Event

8 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Devon
Top achievements
Rank 1
Devon asked on 19 Feb 2009, 10:27 PM
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

8 Answers, 1 is accepted

Sort by
0
Devon
Top achievements
Rank 1
answered on 20 Feb 2009, 12:25 AM
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.
0
Valeri Hristov
Telerik team
answered on 23 Feb 2009, 05:15 PM
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.
0
Devon
Top achievements
Rank 1
answered on 23 Feb 2009, 10:19 PM
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
0
Devon
Top achievements
Rank 1
answered on 23 Feb 2009, 10:35 PM
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.

0
Jordan
Telerik team
answered on 27 Feb 2009, 12:40 PM
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.
0
Devon
Top achievements
Rank 1
answered on 27 Feb 2009, 07:25 PM
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.
0
Devon
Top achievements
Rank 1
answered on 27 Feb 2009, 07:26 PM
I'm not sure how to upload the project though. 
0
Rosi
Telerik team
answered on 02 Mar 2009, 12:11 PM
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.
Tags
GridView
Asked by
Devon
Top achievements
Rank 1
Answers by
Devon
Top achievements
Rank 1
Valeri Hristov
Telerik team
Jordan
Telerik team
Rosi
Telerik team
Share this question
or