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

[Solved] NewBee needs jump start

4 Answers 152 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 18 Mar 2009, 02:03 AM
Hi,

I downloaded the Silverlight controls and looked at the example.  It is very impressive but I am hoping that you can provide a very simple grid example cookbook style that will give me a jumpstart..  i.e. Step 1 - create new visual studio project Silverlight ASP.NET.  Step 2 create grid xaml example  Step 3 Create Code behind example Step 4. Add WCF web service etc. etc.  If you have a working example of something like this would be greatly appreaciated.

Thanks
Rich

4 Answers, 1 is accepted

Sort by
0
Hristo Deshev
Telerik team
answered on 18 Mar 2009, 09:48 AM
Hi Richard,

I believe, you can use this example as a starting point. It is shipped with the installer, and you have full source code for both the ASP.NET website (the ExamplesWeb project), the Silverlight project (the Examples.GridView.GridView.CS or Examples.GridView.GridView.VB projects). The ExamplesWeb also hosts a ADO.NET data service that the example binds to.

We do not have a WCF service example yet, but plan to add one pretty soon. Tell me if you need additional help with getting that example running.

Greetings,
Hristo Deshev
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Richard
Top achievements
Rank 1
answered on 24 Mar 2009, 06:51 PM
Hi,

I have written a data service that returns the following data object List<Customer>.  I want the class to display in the datagrid as a hiarchy and since I have many other data objects I would like the datagrid to be able to also display the other data objects dynamically.  I'm hoping that the datagrid can build the hiarchy dynamically based on the class provided.  I am currently using the Microsoft DataGrid which does not display the hiarchy and I would like to replace it with the Telerik datagrid.   See Customer class and my current XAML code below.  I highlighted the Datagrid xaml...its at the end..


Thanks
Rich

Class Customer
   String  CustomerID
   String  CompanyName  
   Order  Order

Class Order
   String CustomerID
   Int32 OrderID
   DataTime OrderDate
   Order_Detail Order_Detail

Class Order_Detail
  Int32 OrderID
  Decimal UnipPrice
  Int32 Quantity

<

UserControl xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" x:Class="SilverlightForDataClip.Page"

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

Width="800" Height="600">

 

 

<Grid x:Name="LayoutRoot" Background="White" ShowGridLines="False">

 

 

<Grid.RowDefinitions>

 

 

<RowDefinition Height="10" />

 

 

<RowDefinition Height="50" />

 

 

<RowDefinition Height="*" />

 

 

<RowDefinition Height="10" />

 

 

</Grid.RowDefinitions>

 

 

<Grid.ColumnDefinitions>

 

 

<ColumnDefinition Width="10" />

 

 

<ColumnDefinition Width="*" />

 

 

<ColumnDefinition Width="10" />

 

 

<ColumnDefinition Width="10" />

 

 

</Grid.ColumnDefinitions>

 

 

<Border BorderBrush="Black" BorderThickness="2"

 

 

Grid.Row="1" Grid.Column="1"/>

 

 

<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">

 

 

<TextBlock Text="Last name to search for: " VerticalAlignment="Bottom"

 

 

FontSize="18" Margin="15,0,0,0" />

 

 

<TextBox x:Name="LastName" Width="250" Height="30" Margin="2,0,0,4"

 

 

VerticalAlignment="Bottom"/>

 

 

<Button x:Name="Search" Click="Search_Click" Width="75" Height="30" Margin="20,0,0,4" Content="Search"

 

 

VerticalAlignment="Bottom" Background="Blue" FontWeight="Bold" FontSize="14" />

 

 

<Button x:Name="GetDataClip" Click="GetDataClip_Click" Width="110" Height="30" Margin="20,0,0,4" Content="Get DataClip"

 

 

VerticalAlignment="Bottom" Background="Blue" FontWeight="Bold" FontSize="14" />

 

 

</StackPanel>

 

 

***************************************************************************************
<
data:DataGrid x:Name="theDataGrid" AlternatingRowBackground="Beige" AutoGenerateColumns="True"

 

 

Width="770" Height="500" Grid.Row="2" Grid.Column="1" CanUserResizeColumns="True" />

 

 

***************************************************************************************
</
Grid>

 

</

UserControl>

 


  
0
Richard
Top achievements
Rank 1
answered on 25 Mar 2009, 12:58 AM
Hi,

See last email from me for this thread.  I tried to change the Microsoft Grid for the Telerik grid, but it fails when the page is loading. I'm hoping you can help.  If I pull out the reference to  theTelerik Grid and go back to the MS Grid it works.

Thanks
Rich

 

public Page()

 

{

InitializeComponent();

Should I be doing something here?
I don't access the web service to get the data until a button is pressed,
However the page with the button does not get rendered.
}


private

void Application_Startup(object sender, StartupEventArgs e)

 

{

 

this.RootVisual = new Page();

 

Fails here when I press F10 and goes to to Application_UnhandledException
  Message:
Could not load file or assembly 'System.Windows.Controls.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=3d8c6023c75a3242' or one of its dependencies. The system cannot find the file specified.

Stack Trace:   
   at Telerik.Windows.Controls.GridView.GridViewItemsControl.DisconnectFromDataEvents()
   at Telerik.Windows.Controls.GridView.GridViewItemsControl.ReconnectToDataEvents()
   at Telerik.Windows.Controls.GridView.GridViewItemsControl.GridViewItemsControl_Loaded(Object sender, RoutedEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

private

void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)

 

{

 

// If the app is running outside of the debugger then report the exception using

 

 

// the browser's exception mechanism. On IE this will display it a yellow alert

 

 

// icon in the status bar and Firefox will display a script error.

 

 

if (!System.Diagnostics.Debugger.IsAttached)

 

{

 

// NOTE: This will allow the application to continue running after an exception has been thrown

 

 

// but not handled.

 

 

// For production applications this error handling should be replaced with something that will

 

 

// report the error to the website and stop the application.

 

e.Handled =

true;

 

 

Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });

 

}

}

******************* XAML****************************

 

<

UserControl

 

 

xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"

 

 

xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"

 

 

x:Class="SilverlightForDataClip.Page"

 

 

 

 

 

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

 

 

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

 

 

Width="800" Height="600">

 

 

 

 

 

 

<Grid x:Name="LayoutRoot" Background="White" ShowGridLines="False">

 

 

 

 

 

<Grid.RowDefinitions>

 

 

 

 

 

<RowDefinition Height="10" />

 

 

 

 

 

<RowDefinition Height="50" />

 

 

 

 

 

<RowDefinition Height="*" />

 

 

 

 

 

<RowDefinition Height="10" />

 

 

 

 

 

</Grid.RowDefinitions>

 

 

 

 

 

<Grid.ColumnDefinitions>

 

 

 

 

 

<ColumnDefinition Width="10" />

 

 

 

 

 

<ColumnDefinition Width="*" />

 

 

 

 

 

<ColumnDefinition Width="10" />

 

 

 

 

 

<ColumnDefinition Width="10" />

 

 

 

 

 

</Grid.ColumnDefinitions>

 

 

 

 

 

<Border BorderBrush="Black" BorderThickness="2"

 

 

Grid.Row="1" Grid.Column="1"/>

 

 

 

 

 

<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">

 

 

 

 

 

<TextBlock Text="Last name to search for: " VerticalAlignment="Bottom"

 

 

FontSize="18" Margin="15,0,0,0" />

 

 

 

 

 

<TextBox x:Name="LastName" Width="250" Height="30" Margin="2,0,0,4"

 

 

VerticalAlignment="Bottom"/>

 

 

 

 

 

<Button x:Name="Search" Click="Search_Click" Width="75" Height="30" Margin="20,0,0,4" Content="Search"

 

 

 

 

 

VerticalAlignment="Bottom" Background="Blue" FontWeight="Bold" FontSize="14" />

 

 

 

 

 

<Button x:Name="GetDataClip" Click="GetDataClip_Click" Width="110" Height="30" Margin="20,0,0,4" Content="Get DataClip"

 

 

 

 

 

VerticalAlignment="Bottom" Background="Blue" FontWeight="Bold" FontSize="14" />

 

 

 

 

 

</StackPanel>

 

 

 

 

 

<telerikGridView:RadGridView x:Name="radGridView1" Grid.Row="2" Grid.Column="1" IsReadOnly="True"

 

 

Width="770" Height="500" ColumnsWidthMode="Fill">

 

 

</telerikGridView:RadGridView>

 

 

 

 

 

</Grid>

 

</

UserControl>

 

 


 

0
Nedyalko Nikolov
Telerik team
answered on 27 Mar 2009, 03:24 PM
Hi Richard,

It seems that you do not have reference to System.Windows.Controls.Data. In this forum thread you can find information how to solve the problem.

About the first post:
What you need is a "Property Hierarchy". There is a good example in our online demo how to create such hierarchy with a few lines of code.

Best wishes,
Nedyalko Nikolov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Richard
Top achievements
Rank 1
Answers by
Hristo Deshev
Telerik team
Richard
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or