This is a migrated thread and some comments may be shown as answers.

Setting ItemsSource Property of Rad Grid View From Other Project

8 Answers 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
HARSH
Top achievements
Rank 1
HARSH asked on 28 Jul 2010, 02:31 PM
Hi,

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

Sort by
0
Yavor Georgiev
Telerik team
answered on 28 Jul 2010, 02:32 PM
Hello HARSH,

 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
HARSH
Top achievements
Rank 1
answered on 28 Jul 2010, 02:56 PM

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

 

0
Yavor Georgiev
Telerik team
answered on 28 Jul 2010, 02:59 PM
Hello HARSH,

 Could you please give me the implementation to SetItemsSource?

Best wishes,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
HARSH
Top achievements
Rank 1
answered on 28 Jul 2010, 03:04 PM

 

 

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

0
Yavor Georgiev
Telerik team
answered on 28 Jul 2010, 03:08 PM
Hi 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 you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
HARSH
Top achievements
Rank 1
answered on 28 Jul 2010, 03:51 PM
Can you please let me know where i need to open that support ticket.
Do i need to log that to

Public Issue Tracking SystemBETA

.
0
HARSH
Top achievements
Rank 1
answered on 28 Jul 2010, 04:34 PM
I figured out the issue.
It was due to access modifier of class.
custom Class need to have public modifier.
0
Hristo
Telerik team
answered on 28 Jul 2010, 04:53 PM
Hello HARSH,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
HARSH
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
HARSH
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or