CellEndEdit e.Value is null

3 posts, 1 answers
  1. Jan Pfeffer
    Jan Pfeffer avatar
    55 posts
    Member since:
    Aug 2006

    Posted 22 Aug 2011 Link to this post

    Hey at Telerik

    I have a problem when binding gridview to a List<Car>.
    The Car object contains two objects Engine and CarColor.

    If an Engine or CarColor is initialized on the car object the e.Value in the


    rgvCars_CellEndEdit event is correctly changed and parsed and object is updated.

    If no Engine or CarColor object is initialized on the Car object and i try to set for instance and engine in the combobox, the e.Value in  the rgvCars_CellEndEdit event is null and the object is not updated.

    How do i set an Engine or CarColor on the Car object if there's no Engine or CarColor initialized ??

    I have include an example (Without an assembly) that shows the problem at hand when you try to select for intance an Engine on the Car that doesn't have an Engine object initialzed.

    Link to example. http://kort2.lifa.dk/Examples/GridViewCellEndEditIssue.zip

    Sincerly Jan

  2. Christian
    Christian avatar
    1 posts
    Member since:
    Jun 2011

    Posted 22 Aug 2011 Link to this post

    hi !

    thank you for the sample, on train i checked around a little and found that
    if you rename your "navigatoin-properties"/columns from:

    FieldName: Engine.Name  to  Car.Engine.Name ,
    FieldName: CarColor.Color Car.CarColor.Color

    the update works, but initialisation is somehow wrong. i see you use a singleton for the controller, that's nice ... i have to get off train now ... but maybee it helps getting closer...
    erm update:
    but if you want car to have only 1 engine, which might be what you wanted to say ;) ... the fields should be renamed like that:

    FieldName: Engine.Name  to  Name ,
    FieldName: CarColor.Color to Color

    is see you named them correct  in code , but in this case the defined columns in designer seem to be used ....
  3. DevCraft R3 2016 release webinar banner
  4. Answer
    Stefan avatar
    2891 posts

    Posted 24 Aug 2011 Link to this post

    Hello Jan,

    Thank you for writing.

    The Value in the CellEndEdit method is null because there is no corresponding object initialized for this field. What you can do is make sure that the the fields are initialized on CellBeginEdit and if they are not, you can initialize them manually. Please refer to the attached project, where I have introduced the necessary changes to check if the Engine and CarColor fields are initialized. 

    I hope that you find this information helpful.

    Best wishes,
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top