Ok....had a chance to reaquaint myself with the code. Here's an idea you might want to try:
If you don't already have a stored procedure that can return a filtered result set, create one. For purposes of your question, let's assume you have one called AECodeSelectByType, which takes one parameter (@Type INT).
Ensure you add this stored procedure (AECodeSelectByType) to the .dbml file, and the corresponding DAL class (AECodeData?).
Code:
public class AECodeData : ENTBaseDat<AECode>
{
// other methods
protected override List<AECode> SelectByType(int codeType)
{
// code to call SP goes here
}
// remaining methods
}
In the BLL class AECodeEOList, add an overloaded Load() method.
Code:
[Serializable()]
public class AECodeEOList : ENTBaseEOList<AECodeEO>
{
// other methods
public void Load(int codeType)
{
LoadFromList(new AECodeData().SelectByType(codeType));
}
// remaining methods
}
The LoadFromList will populate the List<T> with all records that have a Type = 4 (or whatever you specify.
Then your UI code would be pretty much unchanged:
Code:
AECodeEOList aeCodes = newAECodeEOList();
aeCodes.Load(4);
ddlPhysicianContacted.DataSource = aeCodes;
ddlPhysicianContacted.DataTextField = "description";
ddlPhysicianContacted.DataValueField = "type";
ddlPhysicianContacted.DataBind();
Hopefully this will get you headed in the right direction, and I think it stays true to the framework. The only thing I'm not entirely sure on is if it's a violation of OOP principles to provide an overloaded method on an overriden method...
Tim