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

Can't update rows from RadGrid

5 Answers 197 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mromani
Top achievements
Rank 1
mromani asked on 26 Jul 2010, 11:22 AM
Hello,

I have the following class:

[Telerik.OpenAccess.Persistent(IdentityField = "id", VersionField = "version")]
    public class City
    {
        
        protected Int64 id;
        
        protected Int64 version;
 
        [FieldAlias("id")]
        public Int64 Id
        {
 
            get { return id; }
        }
 
        [FieldAlias("version")]
        public Int64 Version
        {
 
            get { return version; }
 
            set { version = value; }
 
        }
 
        private string name;
 
        public string Name
        {
            get { return name; }
            set { name= value; }
        }
     
    }

In forward mapping wizard I set identity single field and autoinc verify by version with field version.

Then I created a web page with a RadGrid and and OpenAccessDatasource, in the MasterTableView dataKeyValues="Id,Version"

I can add rows but when I try to update or delete an already existing row I get the following error:

Telerik.OpenAccess.Exceptions.NoSuchObjectException: No row for FormaModel.Citiy ('cities') GenericOID@a City id=0 NOTRES

[NoSuchObjectException: No row for FormaModel.NivelEstudios ('cities') GenericOID@a City id=0 NOTRES ]
   Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28
   Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +34
   OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x) +1455
   OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.getObjectById(Object oid, Boolean validate) +1129
   OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.getObjectById(Object o, Boolean b) +61
   Telerik.OpenAccess.RT.ObjectScope.GetObjectById(IObjectId oid) +147

I have been trying diferent versions  for the last 3 days but with any success.

Seems like grid is not sending keyvalues for edited row

Thanks,

Miguel

5 Answers, 1 is accepted

Sort by
0
mromani
Top achievements
Rank 1
answered on 27 Jul 2010, 10:06 AM
Hi,

To trace what's happening when I click update in the edit form, I have activates logging in the OpenAccess Backend configuration as follows:

<logging.logEventsToTrace>True</logging.logEventsToTrace>
        <logging.logEvents>verbose</logging.logEvents>
        <lockTimeout>5000</lockTimeout>
        <logging.logEventsToSysOut>True</logging.logEventsToSysOut>
        <logDownloader.eventText>True</logDownloader.eventText>
        <logDownloader.filename>C:\Projects\Gaps_21_Ideas\OA.log.txt</logDownloader.filename>

in the app.config of the model class library but there is no output to this file neither to the output window.

How can I trace how the updating object keys are passed from the grid to the datasource?
0
mromani
Top achievements
Rank 1
answered on 27 Jul 2010, 10:23 AM
I have created 5 methods for the following events

protected void OpenAccessDataSource1_Updating(object sender, Telerik.OpenAccess.OpenAccessDataSourceChangingEventArgs e)
        {
            string nada = "";
        }
 
        protected void OpenAccessDataSource1_Updated(object sender, Telerik.OpenAccess.OpenAccessDataSourceChangedEventArgs e)
        {
            string nada = "";
        }
 
        protected void OpenAccessDataSource1_ContextCreated(object sender, Telerik.OpenAccess.OpenAccessDataSourceContextCreatedEventArgs e)
        {
            string nada = "";
        }
 
        protected void OpenAccessDataSource1_ContextCreating(object sender, Telerik.OpenAccess.OpenAccessDataSourceContextCreatingEventArgs e)
        {
            string nada = "";
        }
 
        protected void OpenAccessDataSource1_DataBinding(object sender, EventArgs e)
        {
            string nada = "";
        }

Each one with a breakpoint  but only ContextCreating and ContextCreated are reached when clicking the update button in the edit form.

Shouldn't  Updated and Updating events  be fired?

Thanks ,

Miguel
0
Petko_I
Telerik team
answered on 29 Jul 2010, 10:18 AM
Hello mromani,

We were able to reproduce your first error and what we discovered is that the exception is thrown when you do not have a setter for the Id property. If you add a setter the problem should disappear.

When you get the exception, the updated event shouldn’t be fired as the update was not successful. However, you are right that the updating event should have fired. In order to enable event tracing you need to also specify the appropriate options such as the logging level, etc. Here is a blog post that sheds some light on this topic.
Yet, we have tested the logging mechanism with a similar setup and found an issue on our side with the console logging. The logging to a file is a bit confusing right now.
In the meantime, what I can propose for tracing is to specify a file, set the event tracing to true, set the log level to all and set the write events to text file to true. The expected behavior is you will receive an additional file created in the same folder of your original file – the new file will have the same name as the old one but with an extra extension .txt added to it. Now the tracing with this newly generated file should be fine.
Your Telerik points have been updated for pointing this problem to us.

Greetings,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
mromani
Top achievements
Rank 1
answered on 29 Jul 2010, 11:14 AM
Hi Petko,

I have uninstalled everything about telerik from my computer and deleted any Telerik.* dll or file.
I have installed RadCoontrol for aspnet ajax 2009. Q2
I have installed OpenAccess Express 2010..... (to have the last version)

When I remove BaseEntityClass, and have the id and version fields directly in the peristent class it works and I can Update.
When I use the BaseEntity class as an abstract superclass it fails.
You are wright, I don't have a setter, I didn't even realized it was missing.

I will try again with the new setup as I had a lot of problems at the same time and every test I made broke the previous solution applied.

Thanks for your help,
Miguel

0
Petko_I
Telerik team
answered on 03 Aug 2010, 07:50 AM
Hi mromani,

I am glad I could help. Regarding your next question, I think you can benefit from the horizontal mapping inheritance strategy. You can find more information on this topic in our updated online help.

Do not hesitate to contact us if you need further guidance.


All the best,
Petko_I
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
mromani
Top achievements
Rank 1
Answers by
mromani
Top achievements
Rank 1
Petko_I
Telerik team
Share this question
or