Print Page | Close Window

ASPDataSource and updating...

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=449
Printed Date: 12-Apr-2026 at 2:40pm


Topic: ASPDataSource and updating...
Posted By: CetinBasoz
Subject: ASPDataSource and updating...
Date Posted: 24-Sep-2007 at 10:34am
DoStandardUpdateSingleEntity do not cover all types (and it says that in learning scripts).
I was surprised to see it doesn't update boolean fields so I created:
 
public class EntityAM:EntityAdapterManager
{
  public void DoStandardUpdateByPk(PrimaryKey pk,
               
IDictionary  newvalues)
  {
    
Entity ent = this.PersistenceManager.GetEntity(pk);
     UpdateProperties(newvalues, ent);
   }
   public void UpdateProperties(IDictionary newvalues, Entity ent)
  {
    // ...
   }
}
 
UpdateProperties are used by both UpdateEntity() and InsertEntity().
 
It works. I'm not sure if I'm doing it right ( DoStandardUpdateSingleEntity() was protected so I did mine this way ). Could you tell me if there were a better way.
 
PS: I did first with DevForceDataSource and made it to work with Ajax. Converting to ASPDataSource, lost Ajax behavior I had successfully before.
It was a GridView and DetailsView and what specifically happens:
It updates DetailsView if SelectedIndexChanged but when PageIndexChanged it updates 'with previous record data'.  Before with DevforceDataSource it was working just as I want it to be.
Working on it (actually doing from scratch now) and would appreciate if anyone has an idea what I may be missing.
Thanks in advance.
 
I would like to see a forum section devoted to ASP.



Replies:
Posted By: davidklitzke
Date Posted: 24-Sep-2007 at 3:24pm
I think that you came up with a good solution.  However, I would recommend that you use an abstract class to prevent the user from using improper signatures.
 
The ZIP file I am attaching has the source code for the EntityAdapterManager.cs.
 
http://www.ideablade.com/forum/uploads/20070924_182424_EntityAdapterMa.zip - uploads/20070924_182424_EntityAdapterMa.zip
 
 


Posted By: davidklitzke
Date Posted: 24-Sep-2007 at 3:27pm
Can you send me instructions on how to reproduce the problem with Ajax?  Please send this information to mailto:support@ideablade.com - support@ideablade.com .


Posted By: CetinBasoz
Date Posted: 25-Sep-2007 at 12:45am
Thank you very much for the source code. It will defintely help me to understand inner workings better:)

For the Ajax problem I will send you both DevforceDataSource version (3.5.3.1) and the ASPDataSource version (3.5.4.1) along with the partial MSSQL data ASAP so you can reproduce there.


Posted By: CetinBasoz
Date Posted: 26-Sep-2007 at 8:26am
Hi David,
Looks like it was not fault of ASPDataSource. Me or ASP itself, not sure at the moment:) I'll update you later (I almost got it to work just as I want it to be).
 
Update: For the lurkers, it was not due to change from DevforceDataSource to ASPDataSource but to a glitch in ASP.Net itself. During conversion I unintentionally removed a code line which made it to work before. It doesn't seem logical to me but it works when in Page_Load I have:
 
{
//...
  bool dummy = (grdPerson.SelectedDataKey != null);
}
 
Invoking get is appearantly forcing a kind of refresh for the selected record.



Print Page | Close Window