Multiple Parameters for Filtered List in WPF

Multiple Parameters for Filtered List in WPF

Old forum URL: forums.lhotka.net/forums/t/6708.aspx


thaehn posted on Tuesday, March 31, 2009

Hi,

I am writing my first "real" application in CSLA and have been following the Project Tracker as an example.  I am trying to create a WPF edit form to do a search for items matching criteria and am using the ProjectList as an example.  My form, however, has three parameters.  One is a foreign key for which I have a ComboBox and the other two are a date range for which I am using the DatePicker control from the toolkit.  The results are to populate a toolkit grid.  I couldn't figure out how to bind the ComboBox to the List business object (ReadOnlyListBase), so I instad hooked up an event call to the DropDownClosed of the ComboBox and the LostFocus event of the Dates.  I check for valid values and then set the parameters:

using (dp.DeferRefresh())

{

   dp.FactoryParameters.Clear();

   dp.FactoryParameters.Add(System.Int32.Parse(LocationComboBox.SelectedValue.ToString()));

   dp.FactoryParameters.Add(Csla.SmartDate.Parse(RangeStart.Text));

   dp.FactoryParameters.Add(Csla.SmartDate.Parse(RangeEnd.Text));

   if (dp.Data != null)

      {

      AlertList SearchList = (AlertList)dp.Data;

      if (SearchList.Count > 0)

      {

      AlertDataGrid.SelectedIndex = 0;

      AlertDataGrid.Visibility = Visibility.Visible;

      }

   }

}

Once I have valid values that return data, I get an exception:  DataPortal.Fetch failed (Nullable object must have a value).

Any Idea what I am doing wrong?

 

thaehn replied on Wednesday, April 01, 2009

I found the issue.  The stored procedure was changed and the column names did't match what LINQ had, so it made them null (which wasn't allowed by item because the type wasn'n nullable). 

Copyright (c) Marimer LLC