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

Ignore column when updating

3 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mohammed
Top achievements
Rank 1
Mohammed asked on 18 Mar 2011, 10:15 AM
Hi,

I have an object that contains a property to combine different ids and that for display purposes. but when i try to update row values, it also pass it value to the "ValueProvider" in which case the UpdateModel will fail.

I have used Visibile(false), but i cannot get the column values once it render.

How to ignore/remove a column data when updating?.

Thanks.

Mohammed

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 18 Mar 2011, 10:35 AM
Hello Mohammed,

I am not sure that I understand what your goal exactly is, but you can try TryUpdateModel or use AutoMapper and ViewModel for this case.

If my understandings are not correct, I will appreciate some code snippets which will clarify the issue. 

Kind regards,

Georgi Krustev
the Telerik team
0
Mohammed
Top achievements
Rank 1
answered on 18 Mar 2011, 11:07 AM
Hi Georgi,

my DTO:

public int id {get;set;}
public List<SomeObject> SomeIds {get; set;}
public blah blah ........

public string CombineSomeIds
{
    get
    {
        SomeIds.Select(x => x.Id.ToString()).ToList();
    }
}

Now i want to use CombineSomeIds to in my grid view to store these values for later manupilation. but when i update my DTO object (from Grid) it passes "CombineSomeIds" values even without the Column name.

Im using Automapper, and it maps my DTO to my other object correctly but it fails when i try to update model. 

I hope this direct you to my point.

Thanks

Mohammed.
0
Georgi Krustev
Telerik team
answered on 19 Mar 2011, 11:14 AM
Hello Mohammed,

 
Thank you for the clarification.

Nevertheless it still hard to understand where could be the problem. I will ask you simple test project which reproduces the issue. Thus I will be able to observe it and advice you futher.

Regards,
Georgi Krustev
the Telerik team
Tags
Grid
Asked by
Mohammed
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Mohammed
Top achievements
Rank 1
Share this question
or