Getting error when trying to run Sample

5 posts, 1 answers
  1. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 17 Feb 2010 Link to this post

    Hi;
    I'm Running Q3 Jan 14 version and when I try to run the RIA Datasource sample on my machine, I get the following error. I've already fixed the connection to connect with my local Northwind.
    ----------------
    throw new Error("Unhandled Error in Silverlight 3 Application An error occurred while loading data through the 'GetCustomers' query on DomainContext of type 'NorthwindDomainContext' and the error was not handled.  If this error is expected, then you must handle the LoadedData event on the DomainDataSource and call LoadedDataEventArgs.MarkErrorAsHandled() to avoid this exception.\n\nLoad operation failed for query 'GetCustomers'. Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.   at System.Windows.Ria.OperationBase.InvokeCompleteAction()\n   at System.Windows.Ria.OperationBase.Complete(Exception error)\n   at System.Windows.Ria.LoadOperation.Complete(Exception error)\n   at System.Windows.Ria.DomainContext.CompleteLoad(IAsyncResult asyncResult)\n   at System.Windows.Ria.DomainContext.<>c__DisplayClass17.<Load>b__13(Object )");
    ----------------

    Secondly, is there a new sample that shows how to do CRUD with the PDC version of RIA and your grid. I found an old sample with context menu to ADD and DELETE. But the add function would not work or even add a new row. It would be great to have a CRUD and data validation in the grid.

    Does the Datavalidation in RADGrid, work the same way as DataForm using the metadata from RIA services?
    Thanks!
  2. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 19 Feb 2010 Link to this post

    Hello Ben,

    Looking at the stack trace it seems that you should update your connection string. You have to remove "User Instance=True" setting in the web.config file in the asp.net application. 

    We did not have any specific example illustrating CRUD operations, but you can start with any RIA example on the web and just bind RadGridVew to a DomainDataSource. RadGridView will group and sort out of the box on the server via the DomainDataSource and if you want filter on the server you have to look at this online example. You can easily add new items by pressing insert key. Also you can add a button that calls SubmitChanges() on the DomainDataSource.

    As for the data validation it is working as expected. Actually RadGridView plays nicely with DataForm as you can see from the application in this forum thread.

    Have a nice day,
    Stefan Dobrev
    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.
  3. DevCraft banner
  4. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 19 Feb 2010 Link to this post

    Hi Stefan;

    Looking at the stack trace it seems that you should update your connection string. You have to remove "User Instance=True" setting in the web.config file in the asp.net application. 

    Apparently, that was inserted by EF, when I tried to "Update" the model in VS2008 to get my local connection and it added the user instance as well and I missed it. Thank you!

    I suppose my question about RIA CRUD came from the long procedures that I had do with MS Grid and Data form to
    a) Create new child window
    b) Create a Data Form with Text Boxes
    c) Create a new object and do all the data binding between text box and the object
    d) If the user clicked on accept button, then pass the object back to parent for to add it to the grid
    e) Do a submit changes to get to database.

    I'm about to convert all the MS grid and this old fashion way of creating each row to Telerik Grid. And that's why asked to see what steps from my previous way has to be changed and based on your answer, it seems like it's going to come down substantially less and it sounded too good to be true, so I asked.

    One question: Every time user presses the insert or I call the InsertRow method, in the code I need to set a few properties for that object, like date/time, user id and company id, which the user will not see on the grid. Do I have to create a new object in the "GridInsertingRow" event and add those properties and then in "InsertEnded" event attach the object to grid's items?
    Or Does the grid create the object for me and in the "GridInsertingRow" even I can set the properties.
    This is one area that I couldn't find answer to in  the help. I'm not in Case of RIA who maintains creating the object and attaching the object to the collection of the Grid?
    Thanks!
  5. Answer
    Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 22 Feb 2010 Link to this post

    Hello Ben,

    Straight to your questions: RadGridView will create an instance of your objects if the type has a default constructor. If not you have to attach to the AddingNewDataItem event and create the instance there. If you want to set a few properties of the object this event is the best place to do it. You don't have to subscribe to any other event, because RadGridView will automatically insert this item into the underlying collection passed as ItemsSource.

    Regards,
    Stefan Dobrev
    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.
  6. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 22 Feb 2010 Link to this post

    Thank you Stefan for clear answers; The RIA version of the Grid has got some nice goodies that the help documents have not covered yet. I hope by Q1 release these new RIA additions get covered in the help.

    REAL Nice work guys. Thanks!
    ..Ben
Back to Top
DevCraft banner