objectdatasource is not referencing the correct constructor depending on the parameters
I have(scaled down version)
private int m_Code;
private string m_FamCode;
private string m_LastName;
private string m_FirstName;
private string m_Init;
private DateTime chargeDate;
private string tranCode;
private decimal paidAmt;
private string description;
Then I have the get\set for each
public int M_Code
{
get { return m_Code; }
set { m_Code = value; }
}
Then I have 3 different constructors that look like the following but pass different amount of properties to each one.
public BBNMemberDetails(DateTime cDate, string tCode, decimal pAmt, string desc)
{
this.chargeDate = cDate;
this.tranCode = tCode;
this.paidAmt = pAmt;
this.description = desc;
}
public BBNMemberDetails(int m_Code, string m_FamCode, string m_LastName, string m_FirstName, string m_Init)
{
this.m_Code = m_Code;
this.m_FamCode = m_FamCode;
this.m_LastName = m_LastName;
this.m_FirstName = m_FirstName;
this.m_Init = m_Init;
this.m_Title = m_Title;
}
default constructor
public BBNMemberDetails() { }
For some reason the only constructor that is being referenced is the one with all my properties. The constructor where I would like to just grab the transaction information is not being referenced. I am using a List in combination of a sqldatareader that references a storedprocedure to grab the values also then just an objectdatasource on the front end to attach it to the gridview. But my gridview shows all the properties instead of just the few I want it to show in the constructor.
When you call a constructor, you get a complete object.
The object isn’t pared down because you call a constructor that initializes fewer members.