New Posts New Posts RSS Feed: ASPDataSource and updating...
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

ASPDataSource and updating...

 Post Reply Post Reply
Author
CetinBasoz View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Turkey
Posts: 4
Post Options Post Options   Quote CetinBasoz Quote  Post ReplyReply Direct Link To This Post Topic: ASPDataSource and updating...
    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.


Edited by CetinBasoz - 24-Sep-2007 at 10:36am
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post 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.
 
 
 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post 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 support@ideablade.com.
Back to Top
CetinBasoz View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Turkey
Posts: 4
Post Options Post Options   Quote CetinBasoz Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
CetinBasoz View Drop Down
Newbie
Newbie


Joined: 15-Jun-2007
Location: Turkey
Posts: 4
Post Options Post Options   Quote CetinBasoz Quote  Post ReplyReply Direct Link To This Post 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.


Edited by CetinBasoz - 27-Sep-2007 at 10:21am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down