I am using a DevExpress LookUpEdit
control. My database has two tables that control the population of control options. One called MaintCategory and one called MaintItem. This introduces a Magic Number into my program(the CategoryID) but allows for lots of runtime customization.
My problem lies in how to allow my users to un-select a dropdown WITHOUT me having to add an "Empty" Item for every CategoryID
. Isn't there a way to inject a blank row? At the control level or when I construct the DataTable
to return?
This is the DAL method that I use to populate all control choices.
public static DataTable GetMaintItems(int iCat)
{
using (var context = CmoDataContext.Create())
{
IQueryable<tblAdminMaintItem> tItems = context.GetTable<tblAdminMaintItem>();
return (tItems.Where(item => item.CategoryID == iCat & item.Active == true).OrderBy(item => item.OrderID).Select(
item => new { item.ItemID, item.ItemDescription })).CopyLinqToDataTable();
}
}