>>Hi,
>>
>>I have a GridView on a form which is giving me this error:
>>
>>Unable to cast object of type 'OakLeaf.MM.Main.Web.UI.WebControls.mmGridView' to type 'OakLeaf.MM.Main.Web.UI.ImmWebBindingSimple'.
>>
>>When I do this:
>>
>>
this.oPolicyRider.NewRow(dsPolicyRider, this.oPolicyRider.TableName);
>> Guid newPK = (Guid)dsPolicyRider.Tables[0].Rows[dsPolicyRider.Tables[0].Rows.Count - 1]["PolicyRiderPK"];
>>
>> // Get the list of Riders & Waivers available for this plan
>> this.dsRiders = this.oPlan.GetRidersAndWaiversByPlan(this.oPolicy.Entity.PlanFK);
>> // default the Rider to the first item in the Riders data session
>> dsPolicyRider.Tables[0].Rows[dsPolicyRider.Tables[0].Rows.Count - 1]["RiderFK"] = this.dsRiders.Tables[0].Rows[0]["PlanPK"];
>>
>> // default the CountryFK to the first item in the Country data session
>> //dsAddress.Tables[0].Rows[dsAddress.Tables[0].Rows.Count - 1]["CountryFK"] = this.oCountry.DataSet.Tables[0].Rows[0]["CountryPK"];
>>
>> this.BindControl(this.grdRiders);
>>
>>The error occurs on the BindControl line.
>>
>>I've done many grids like this and not seen this error before, so I figure it's something simple but can't see what is wrong.
>>
>>Any help appreciated.
>>
>
>I'm really stuck here. :( Has anybody got any ideas?
Frank,
Have you tried to step into the BindControl method so you can inspect things to see what might be happening?
Also have you verified the value of newPK and checked the DataSet Visualizer on dsRiders and dsPolicyRider?
Those don't really make sense to the error message, but I would verify. Based on the error message you are getting it would appear that maybe there is a reference that isn't good or an old dll still exists somewhere in your project bin folder or somewhere. Did you recently upgrade the version of MM? I would check the bin folder and make sure you don't have any old dll's still in there.
Beyond that, I would step into that method and maybe get better clues.
Tim
Timothy Bryan