I am having two Project.
1) Project A :- One Page of this contains RAD Grid.
2) Project B- It contains Pages of Project A.
If i am setting ItemSource of Rad Grid(Which is there in Project A) from Project B Page it throws unhandled exception.
Please let me know how to solve this issue.
8 Answers, 1 is accepted
Could you please give us more details about your scenario? We need to know the Exception type, the stacktrace, what statement triggered the exception, etc.
Sincerely yours,Yavor Georgiev
the Telerik team

Hi,
Below is code snippet and details of app.
1) Assembly 1: contains RadGrid in a class named MySampleClass.MySampleClass Contains a method with name SetItemsSource.This method sets RadGridView Itemsource.
2) Assembly2 : Referes Assembly 1.In Assembly 2 i am defining a Person Class.I am creating a instance of List<Person>.In my page i have reference of MySampleClass(instance name is grdView).When i am calling grdView.SetItemsSource method it throws an exception.
public MainPage()
{
InitializeComponent();
List<Person> personList = new List<Person>()
{
new Person(){Name="harsh",Age="23"},
};
//grdView1 is instance of class MySampleClass
grdView.SetItemsSource(personList);
}
}
Stack Trace:
at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)
at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, UInt32 invocationFlags)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.Linq.EnumerableQuery.Create(Type elementType, IEnumerable sequence)
at System.Linq.Queryable.AsQueryable(IEnumerable source)
at Telerik.Windows.Data.QueryableFactory.CreateQueryable(IEnumerable source)
at Telerik.Windows.Data.QueryableCollectionView.InitializeQueryableSourceCollection()
at Telerik.Windows.Data.QueryableCollectionView..ctor(IEnumerable sourceCollection)
at Telerik.Windows.Data.DataItemCollection.CreateCollectionView(IEnumerable source)
at Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source)
at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass49.<Bind>b__48()
at Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
at Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue)
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnApplyTemplate()
at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)
InnerException = {System.MethodAccessException: Attempt by method 'System.Linq.EnumerableQuery.Create(System.Type, System.Collections.IEnumerable)' to access method 'System.Linq.EnumerableQuery`1<System.__Canon>..ctor(System.Collections.Generic.IEnumerable`1<System.__Canon>...
Please let me know if you need any more details.
Thanks
Could you please give me the implementation to SetItemsSource?
Best wishes,Yavor Georgiev
the Telerik team

Below is the code snippet6 for SetItemsSource Method.
public void SetItemsSource(IEnumerable dataSource)
{
rView.ItemsSource = dataSource;
}
Here instead of IEnumerable i tried passing object as well as Observable Collection
Thanks,
Harsh
This is more peculiar than I thought. Could you please open a support ticket and attach your application so that we can study it?
Sincerely yours,Yavor Georgiev
the Telerik team

Do i need to log that to
Public Issue Tracking SystemBETA
.
It was due to access modifier of class.
custom Class need to have public modifier.
I am glad that you find the solution.
As for the Support tickets - you can open them from Your Account->Your Support->Send Us Support ticket.
Regards,
Hristo
the Telerik team