I'm creating a lookup control that has different ways of looking up company records. We want to display a series of fields for finding companies by Company Name, By Contact Name, by Product Serial number, etc.
Each text box is followed by a button that triggers a method in the code behind, which eventually runs a biz obj method such as:
getCompaniesByCompanyID()
getCompaniesByCompanyName()
getCompaniesByContactName()
getCompaniesByProductSN()
etc.
On the web form I have a grid that is bound to the "Company" object of the form.
The problem is that I have different sets of fields being returned based on what's critical. The getCompaniesByContactName() method, for example, returns additional info (from a join condition) about the contacts associated with the companies.
For now I'm creating "dummy" fields in the simple queries (using the Select "" as extrafield approach) but it seems there's a better way to do this. I do have the DefaultSQL property set, so updates are working OK.
It's a bit tedious that every time I create a new getBy method, I have to ensure that all the fields are matched (whether real or not) and available from each method. I'm using legacy tables with too many fields to just blindly perform a select all (althought that wouldn't help really).
I was thinking perhaps I should define a different grid for each dataset returned by each getby method, but I supposed that would entail custom binding, right?
Any suggestions?
TIA,
Chris.