Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming Programming with .NET - General Encapsulate Silverlight (DataGrid control) with ASP.NET Controls
9 replies. Latest Post by dotnetmac on March 17, 2008.
(0)
dotnetmac
Member
28 points
19 Posts
03-14-2008 12:55 PM |
Hi All,
I need to create a silverlight DataGrid control from ASP.NET. I am able to create normal controls like button and canvas, but unable to create any control derived from System.Windows.Controls. Basically i need to bind the DataGrid control with data from my ASP.NET app.
Please help !!!
Nokola
66 points
13 Posts
03-14-2008 2:18 PM |
Hi dotnetmac,
What happens when you try creating the controls? Do you get an error message? What is the failure message/dialog/error text that you're seeing?
btw maybe the issue is with System.Windows.Controls.Data because Button is from the System.Windows.Controls namespace.
03-14-2008 2:30 PM |
Hey bro,
it was just a canvas which was used to create a button in 1.1. Now with new System.Windows.Controls how do i create these controls from an ASP.NET application
03-14-2008 3:50 PM |
If you're creating a new application, these are the steps to add a DataGrid to it:
1. In VS, click create New Project, select C# (or VB), select Silverlight, Click Silverlight Application on the right then OK
2. Open Page.xaml
3. Drag-drop DataGrid from the toolbox inside the XAML <Grid></Grid> tags, same with Button, etc
Did this resolve the issue?
03-15-2008 8:32 AM |
Ho do i set the datasource from an ASP.NET application ?
03-16-2008 2:11 PM |
Hi there,
Still waiting for ur reply, please help
03-16-2008 7:30 PM |
This page provides few samples for DataGrid, one of them is setting the data source for the grid:
http://msdn2.microsoft.com/en-us/library/cc189058(vs.95).aspx
This is the sample that shows how to bind the DataGrid to data: DataGrid..::.ItemsSource
03-17-2008 2:14 AM |
Bro,
I wanted to sent the datasource from an ASP.NET page. Thats why i thought of dynamically creating the datagrid xaml from an ASP.NET page, which i couldn't succeed. Please help me in dynamically creating xaml from ASP.NET page for an controls under System.Windows.Controls or how do i set the properties of silverlight controls from an ASP.NET page, espicially for a DataSource property.
Thank you very much for your time in responding. You doing a favor to all of us. espicially me :))
Yi-Lun L...
All-Star
25068 points
2,749 Posts
03-17-2008 6:15 AM |
Unfortunately you can only create XAML on the server that doesn't require client code behind. You can't set data source or use any data binding on these XAML pieces. You have to assign the data source and create data binding on client in code after you use XamlReader.Load to load the content. But why do you want to do so? Silverlight is designed to work with asynchronously calling web services mode, not post back mode. Don't put everything on the server. Try to move more and more to the client. You should call a web service to get data on the client, and then create a data source. No need to dynamically create the XAML. That'll save you a lot of efforts.
03-17-2008 6:55 AM |
Thanx bro,
If this is the actual way of doing it, then i will. Thanx for your effort and time