Hi,
I am very new to the LLBLGen Universe, and am very excited to be making my first steps in learning how to use it well and proper. I have been up for a long while making baby steps forward, and I can now move data in and out of the database with SelfService code. It's a great start. And, I am a bit stuck now too and would like to ask for help, please.
I have two LLBLGenProDataSource components in an ASP.NET project. One of them is for a collection of User records. The other is for the detail of a User record. The Collection is bound to a DataGrid, and the Detail DataSource is bound to a DetailsView control.
I would like to select a row in the DataGrid, and based on the Guid value of the row, call up the Details for the DetailsView. The Guid is being used as the PrimaryKey for the UserEntity.
The DataGrid has a Button on each row that generates a CommandArgument which contains the Guid of the Row. This button works in moving the correct data to the method. However, the code I am using to update the Detail DataSource is crashing with this error:
Invalid cast from 'System.String' to 'System.Guid'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Invalid cast from 'System.String' to 'System.Guid'.
The code I am using to process this request is:
protected void userCollectionDataGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ViewUserDetail")
{
IPredicateExpression filter = new PredicateExpression();
filter.Add(new FieldCompareValuePredicate(UserFields.Id, ComparisonOperator.Equal, e.CommandArgument));
userDS.FilterToUse = filter;
userDS.EntityCollection.FindMatches(filter);
}
}
Can you please tell me what I am doing wrong?
I am using LLBLGen.Pro 2.0 with SQL Server 2005, and ASP.NET 2.0.
Thank you!
Mike