Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Odd ObjectDataSource Event Issue with Generic List of objects

Thread Tools

Odd ObjectDataSource Event Issue with Generic List of objects

Posts: n/a

I am new to C# and ObjectDataSources and have encountered what I
think is a strange problem. I have a web page that has a formview on
it. The formview is set to insert mode in the page load. The
ObjectDataSource for the form has a procedure for inserting. Ths
procedure adds the new record to the database using a tableadapter but
it also adds the record to a generic list of business objects which
has been placed into a session variable earlier in the life of the

What is happening is that when I add the new record to the list it
fires the ObjectDataSource's inserted event. This messes everything
else up that comes after it; the program returns to the insert proc
and the new business object I've that I tried to add to the list no
longer is instantiated and has no value.

If I take out the add to the list everything is fine and I can
retreive values from OutputParameters and returnvalue. My question is:
Why would adding a record to a generic list fire the
ObjectDataSource's inserted event? The select procedure (which I
assume is not fired in this case) binds a datatable converted from the
same generic list of business objects (not the list itself) so I can't
see how the changing this generic list would have any connection to
the ObjectDataSource.

Please forgive the redunancy of passing the new record id back
through both OutputParameters and returnvalue; this was part of my

Anyway, any help would be appreciated. Here is the Insert Proc:

public int InsertDevIssue(DateTime EntryDate, int EnteredBy, string
Title, string RequestedBy, int Type, int Area, int Priority, int
Status, int ModifiedBy, DateTime ModifiedDate, int AssignedTo, out int

DevissuesTableAdapters.devissueTableAdapter DevIssuesTblAdp =
new DevissuesTableAdapters.devissueTableAdapter();
Devissues.devissueDataTable DevIssuesTbl = new
Devissues.devissueRow dr = DevIssuesTbl.NewdevissueRow();
dr.EntryDate = EntryDate;
dr.EnteredBy = EnteredBy;
dr.Title = Title;
dr.RequestedBy = RequestedBy;
dr.Type = Type;
dr.Area = Area;
dr.Priority = Priority;
dr.Status = Status;
dr.ModifiedBy = ModifiedBy;
dr.ModifiedDate = ModifiedDate;
dr.AssignedTo = AssignedTo;

NewID = dr.IssueID;

List<clsDevIssues> DevissuesList =
(List<clsDevIssues>)System.Web.HttpContext.Current .Session["clsDevIssues"];
BusinessObjectsGeneric<clsDevIssues> BOG = new
clsDevIssues newDevIssues = new clsDevIssues();

BOG.UpdateObjectFromDB(newDevIssues, dr); //This fills the new
object with the data
DevissuesList.Add(newDevIssues); // This fires the ODS
inserted event prematurely

System.Web.HttpContext.Current.Session["clsDevIssues"] =

return dr.IssueID;


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDataSource and custom objects returning list of another obje Ghistos ASP General 1 06-18-2007 06:04 PM
ObjectDataSource could not find a non-generic method error =?Utf-8?B?dHBhcmtzNjk=?= ASP .Net 1 05-04-2006 03:50 PM
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
ObjectDataSource '---' could not find a non-generic method 'Update' ASP .Net 2 01-02-2006 09:33 AM
Error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'FillMenusByLocation' that has parameters: @locationId Dotnet Gruven ASP .Net 1 09-14-2005 11:48 AM