.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Subject: BUG? Empty Business Object when Configure ObjectDataSource

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

I would like to bind an ObjectDataSource control in my page to a method of 
one of the existing classes in my App_Code folder. However, when I go 
"Configure Data Source..." for this control, the wizard shows an empty 
drop-menu for business object, and I can't choose any of my classes

All my classes in the App_Code compile successfully and I don't understand 
what is causing this problem. Is there a bug?


View Complete Post

More Related Resource Links

Two Copies of an object when choosing business object in objectdatasource


I'm having a problem that I cannot resolve.

I have created a business object that I have placed in my web apps app_code directory.  When I try to reference this object with the objectdatasource 'configur datasource' wizard I see two copies.

If I select one and run I get the following exception:

The type 'SPFSimulatorWeb.App_Code.ModuleBLL' is ambiguous: it could come from assembly 'C:\Users\myusername\AppData\Local\Temp\Temporary ASP.NET Files\root\95af94a9\fff6b138\App_Code.y7vbcqg4.DLL' or from assembly 'C:\Users\myusername\Simulator Development\SimDevelopment\SimulatorWeb\bin\SimulatorWeb.DLL'. Please specify the assembly explicitly in the type name.

I believe that this problem started after I switched one of the references from an .exe from another project to a DLL.  Now I see two copies of whatever the class I make in my App_Code directories.  I have tried deleting the temporary folder but the same error results.  I have even removed the web application from my solution and deleted it, started a new web app, renamed my business object class but the same thing happens. 

I'm pulling my hair out over this.  Has anyone ever seen anything like this?  I've read some of the other threads where they just deleted files or cleaned there solutions but that has not w

ObjectDataSource Update using business object/entity.


I have an ObjectDataSource that I want to perform updates using a business entity (i.e. Type="Object"). Since the values for the entity are within a user control, I have stored a reference to the control in Session and in the updating event, set the new instance to the value of the entity from the user contol property (which also pulls values from the form via other properties of the control):

Protected Sub MasterDataSource_Updating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs) Handles MasterDataSource.Updating

    Dim entity As New Login()

    Dim accountControl As AccountInfo = TryCast(Session("AccountCtrl"), AccountInfo)

        entity = accountControl.Entity

        e.InputParameters.Add("entity", entity)

End Sub

And here's the markup for the datasource:

Business object design in master details.


Hello guys, I have the following scenario,

  1. There is a master business object containing 40 fields
  2. 2 separate child business objects
  3. If I update a child record, I have to update master's 'Last modify by' status along with 3 or more fields in master
  4. For this purpose, I don't want to initialize a separate Master class object (as most of the fields are unused/wasted)
  5. The 'last modify by' also gets updated if the records in master get updated themselves

Currently I have separate business objects for master table, Child 1, Child 2 etc.

How do I control this in my business object design ? Do I break up my master object ? Say I extract last 'modify by ' into a new class, through inheritance or some other way ?

Is there a way that whenever child gets updated I use a 'small' class to update Master status only and whenever the master itself gets updated I do the same.

Problem is that I am having redundancy in my small class (Master class also contains 'Last Modify By ',

What would you advice. Please have your say. Thank you.

Edit  I am using webforms guys.

Managing business object locks on application level

Today I worked out simple application side object locking solution for one server scenario. My motivation came from ASP.NET architecture forum thread How to solve concurrent site issue where one user asks for locking solution that works without changing database. Here is my simple and primitive solution that should help this guy out. I added also sample solution to this posting. My solution is simple: Create class for locked items. Create manager class that holds locks and manages them. Clear locks when session ends. Create page to release all locks. If you need something more serious then you should keep locks information in database or better than that - use some lock server. Also you may consider developing WCF service. LockItem class As a first thing let's create class that keeps lock information. I call this class as LockItem. This class doesn't hold references to locked objects - only type and ID as there are many business layers that doesn't use globally unique identifiers for objects. public class LockItem {     public Type ObjectType { get; set; }     public int ObjectId { get; set; }     public string SessionId { get; set; }     public DateTime LockedAt { get; set; } } LockItem class also contains property for session because otherwise it is not possible to kno

CommunicationException when serializing my business POCO object

Hi! I'm currently blocked by a strange problem, here is the situation: I've a client and a server, running with .Net 4.0 framework. I'm using Entity Framework server side, and WCF to communicate between client and Server. I use POCO object on my Entity Framework model. One month ago, I had a problem: In some case entity framework has already loaded an object and then want to return it when the WCF service is queried. Example: An User has a collection of Orders, and Orders knows which User handle it---> cyclic references I searched online how to resolve this and I found this: http://chabster.blogspot.com/2008/02/wcf-cyclic-references-support.html It worked like a charmed for me until now. I can get data from the server without server, ... Now I'm trying to call my Save(User) method from the client to the server, and I get this error:   System.ServiceModel.CommunicationException was caught Message=There was an error while trying to serialize parameter http://tempuri.org/:User. The InnerException message was 'Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribu

how to configure objectdatasource

Hello, I was wondering if someone could help me with this problem.   First of all, I created my own stored procedure in SQL Server for my aspnetdb database which is :   view plaincopy to clipboardprint? USE [C:\USERS\DAVE\DESKTOP\AUG 19 NEW ONE\APP_DATA\ASPNETDB.MDF]   GO      CREATE PROCEDURE [dbo].[aspnet_GetNotifications]   (       @UserName               nvarchar(256)   )   AS   SELECT UserName,UserNotification,UserNotificationDate   FROM UserNotifications WHERE UserName=@UserName   So, the procedure gets everything from the UserNotifications table, except the RecordID(primary key) which is not needed for display. Now I have set up my BLL and DAL, and everything is working fine, in my DAL, I have the tableadapter and it is called PersonalRecordEntries.xsd in which I have added queries to it using existing stored procedures. Such as : GetLastRecordEntryDate(@UserName) which returns one value which of course is the last record entry date. InsertRecord(@UserName,@TDEE,@BMI,@FTM) which does not return any values, it only inserts a record. AND LASTLY GetNotifications(@UserName) which is supposed to return UserName, UserNoti

Configure managed accounts - object reference not set to an instance of an object - error

I was working in central admin and activated the managed accounts password change for the farm account with the option to change the password now.  I got the email notification that the password was changed and it seems in the log files that it did update all the credentials that were used with the account.  Problem is now that when I hit the configure managed accounts link in central admin all I get is the error: Error Object reference not set to an instance of an object.  Troubleshoot issues with Microsoft SharePoint Foundation. Correlation ID: c6dc7a46-894f-4b85-8711-8af1e8ec7903 Date and Time: 8/23/2010 9:20:20 AM Added information from logs: 08/23/2010 10:41:33.24  w3wp.exe (0x0F2C)                        0x07FC SharePoint Foundation          Logging Correlation Data       xmnv Medium   Name=Request (GET:http://cmtcalcium:33333/_admin/ManagedAccounts.aspx) b9fae5a9-7405-407d-87fc-239dc0ff59d0 08/23/2010 10:41:33.24  w3wp.exe (0x0F2C)                        0x07FC SharePoint Foundation     &n

System.StackOverflowException occur while Serializing Business Object which implements INotifyProper

I try to implement the NTier scenario for a sample application using Remoting, but while try to implement this it giving me the error that SOAP serializer doesn't support serialization of generic List of....blah blah,,,
So I decided to implement my own serialization process like mentioned below and it works fine,

This is the Interface of the DataCentric Component
 obj As
 Custs) As

'This is where I want to talk to database(haven't implemented yet in this code)<br/>


 obj As

DataBinding not updating underlying business object when changing control property from code


I have a custom data form control that in code generates databindings between the selected custom business object (LLBL) and the various controls on the screen. Everything works in that I set the DataContext to the selected business object and the data appears in the GUI. If the user changes anything on screen, the data is getting updated into the business object.

However, now I have some custom logic that when the user presses a button I need to update some fields. Currently I'm setting this data directly into the controls, setting the new value into the property that is bound. However, the data is not getting pushed back into the business object.  I had this same issue building WinForm apps in that databinding only fired if the user was in the control and left it.

Does the same thing apply to WPF? How can I get ANY change on say a TextBox's Text property whether via user interaction or from C# code to push that value into the bound business object property?


configure ObjectDataSource from Code Behind in C#


Hi All,

I have an ObjectDataSource and I want to configure it from code behind , I want to set the InsertMethod , Selectmethod from Code Behind and set it to my Business Layer files

Please help me as soon as you can

Thanks in Advance

Delete object is empty


I have a view that gets populated via this code

public ActionResult Delete(int id)
            return View(_availableService.GetAvailable(id));

the view gets populated perfectly.  then i call this code below availableToDelete object is empty.  What is the reason for this?

        public ActionResult Delete(Available availableToDelete)
                // TODO: Add delete logic here
                if (_availableService.DeleteAvailable(availableToDelete))
                    return RedirectToAction("IndexByStaffEmail", new { email = Session["StaffEmail"] });
                    return View(_availableService.GetAvailable(availableToDelete.AvailableID));
                return View();

DataSet not recognized as buesiness object by ObjectDataSource


I have an ObjectDataSource in Visual Studio 2008.  I have a DataSet defined with a TableAdapter.  However, when I go to select the Table Adapter to use in the ObjectDataSource, nothing shows up.  I double checked that the DataSet is in fact in the App_Code folder.  I do not know what else to try.  The following code is the ASP code for that ObjectDataSource:




asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"

Desing of Hijri/Gregorian Converter Business Object / Class using .NET.


I am developing a Business Object using .NET to perform Conversion from/to Hijri/Gregorian Calendar. Although there is a class in .NET for this purpose, but, still there is a good chance there will be a mistake by at least one day +/- in few cases. In any case, I may depend on this class for conversion, when needed. On the other hand, I already developed this conversion logic under MS Access, and I want to re-use parts of the work done of it in .NET. 

I will post the BO specs summary here to give you an idea about the requirement, so that I can get your feedback, and I will be posting questions mainly related to how to make this BO most efficient, because eventually it will be exposed via a web service.

The Database:

I am storing the required data in tables in MS Access DB, and following is a sample of such tables:


ObjectDataSource NULL to Empty String


I have pass following SQL Query to the through ObjectDataSource

SELECT     RequesterID, CompanyID, Name, emailID, Department, JobTitle, MobileNo, LandLine, Ext, Remarks
FROM         Requester
Where Name Like @Name + '%'

And I am passing parameter through QueryString and My idea is like when empty string is pass it should show me all records but when I am passing empty string ObjectDataSource is making NULL and I am not getting desire result

Kindly can somebody help me on that. It is okay if you change query of help me on objectDataSource.

Business Object properties and Session Variable



I'm having trouble getting the properties of a Business Object between pages.  Right now on the main page's button click event, I instantiate a Business Object, assign its properties with user inputs, store it in Session Variable and open a popup via window.open.  On the popup I retrieve the Session variable and cast it to the business object and try to access its properties.

However in the popup Page_Load event, all the properties of the business object is returned as null.  I have no problem using this method with simple strings/integers instead ot the business object.  I'm not sure how to go about this, any suggestions?

Here's my code example:

// Button click event in main page        
protected void btnViewReport_Click(object sender, EventArgs e)
            ReportObj auditReport = new ReportObj();
            auditReport.PropA = 1;
            auditReport.PropB = "hello";
            auditReport.PropC = DateTime.Now;
            auditReport.PropD = new int[] {1,3,10,87,23};

Specifying the finder method for a business data connected list column's object picker.



I have a BDC xml file which specifies a finder and a specific finder method. These both work fine.

What I want to do is configure the application so that when connected to a list column the object picker uses my finder method rather than the specific finder method which it defaults to. Is this possible?

For further explination if you look at the following image http://i56.tinypic.com/2n22o3m.jpg

If I want to find the department using the objet picker I have to type the full identifier.

If I click the browse (address book icon) to popup the browse window I can then use my finder method. I want the initial object picker to use my find method and if there multiple matches be able to pick one using the popup you get when the message "No exact match was found." is displayed.

Hope this makes some sense!

Cheers Dave

Can use the web parts but using Business data in Lists comes up empty


I am connecting my MOSS 2007 Application template "Call Center" to my CRM to pull the accounts.  I have created the XML definition and it works in both Application Definition Designer (I can execute the GetAccounts->AccountFinderInstance and see the data) and in the Web parts.  Ultimately what I wanted to do was make a sharepoint list using Business Data so I can link a customer(an entity in Sharepoint, defined as a list) to an account in my CRM (by using business data list to connect to the external data).   I am wondering if there is something unique I need to write in the XML to allow the linking of the data to a list.  I currently have these methods:

GetAccounts, GetSpecificAccounts, AccountIDEnumerator

I have an AccountID Identifier and no Actions.  Is there a built in method needed to use business data in sharepoint lists?


I have minimal XML and C# experience and as such was hoping to get this working without having to crate custom interfaces. 

My XML ADF came from http://vspug.com/ssa/2007/05/10/ms-crm-and-sharepoint-2007-integration/

I removed everything except the account and modified the entries for server and initial catalog. 

There are no errors in the creation of busi

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend