accessing properties in code behind using the CslaDataProvider

accessing properties in code behind using the CslaDataProvider

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


germie posted on Wednesday, October 28, 2009

i am using the CslaDataProvider within xaml. i have set up the event handler
DataChanged="CslaDataProvider_DataChanged"
now within the event handler in the code behind i would like to access a property in the object. how do i do this?

germie replied on Wednesday, October 28, 2009

i found the answer to my own question.

Dim dp As Csla.Silverlight.CslaDataProvider = Resources("data")
Dim obj As New testObject
obj = dp.Data

sergeyb replied on Wednesday, October 28, 2009

You could just case sender as CslaDataProvider, especially in case you have multiple providers that all use the same event handler in code behind.

Sergey Barskiy
Principal Consultant
office: 678.405.0687 | mobile: 404.388.1899

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation


-----Original Message-----
From: germie [mailto:cslanet@lhotka.net]
Sent: Wednesday, October 28, 2009 5:16 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] accessing properties in code behind using the CslaDataProvider

i found the answer to my own question.

Dim dp As Csla.Silverlight.CslaDataProvider = Resources("data")
Dim obj As New testObject
obj = dp.Data

germie replied on Thursday, October 29, 2009

thanx for your responce serg. im not sure by what you mean when you say "case sender as cslaDataProvider." i tried looking it up in my expert buisiness objects book and cant figure it out. can you explain, or give an example?

richardb replied on Friday, October 30, 2009

Something like this I think he means.

Dim obj As Suite = TryCast(dp.Data, Suite)

or

Dim obj As Suite = TryCast(sender, Suite)

Copyright (c) Marimer LLC