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

Step through nested sqldatasource in radgrid nestedtemplateview

9 Answers 214 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 27 Jun 2011, 03:54 PM
I have a NestedViewTemplate within a RadGrid.  Within the NestedViewTemplate I have two other Rad-grids showing data to the parent RadGrid.   I'm using a sqldatasource with storedprocedures to populate the data - both on the parent and the embedded grids.  The data is populating just fine for all grids.  However, when attempting to update the embedded grid, I get the error message:

Procedure or function 'x' has too many arguments specified.

I was already able to debug the parent sqldatasource becuase I received the same error.  I did so following another thread on the forum describing how to identify the sql parameters using the sqldatasource updating event to identify the parameters being passed to the data source as well as the names.  However, the Visual Studio 2005 code-behind page doesn't recognize the embedded sqldatasource events.  If I manually create it, I get a compile error.  How can I set up one to view the parameters being passed?

9 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 28 Jun 2011, 08:02 PM
Anyone?  Anyone at all?
0
Pavlina
Telerik team
answered on 29 Jun 2011, 02:31 PM
Hello Richard,

For more information about how to perform automatic operations (update/insert/delete) with SqlDataSource control (part of ASP.NET 2.0) and stored procedures go through the code library below:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/update-insert-delete-with-stored-procedures-and-sqldatasource-control.aspx

You can also review the forum thread below:
http://www.telerik.com/community/forums/aspnet-ajax/radcontrols-in-dotnetnuke/pass-userinfo-displayname-as-insertparameter.aspx

All the best,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Richard
Top achievements
Rank 1
answered on 29 Jun 2011, 02:50 PM
Hi Pavlina,

Thank you for the response.

I know how to use stored procedures and attach them to a radgrid for automatic update/insert/delete events.  However, the trouble that I'm having has to do with an embedded radgrid.  I have a RadGrid1 as the parent radgrid.  Within that parent radgrid I am using a NestedViewTemplate that contains two more RadGrids.  Both nested radgrids contain information that displays correctly based on an ID field from the parent radgrid.  The problem that I am having is with the nested radgrids.  I am unable to process a delete command for the nested radgrid data.  I've set up the datasource and the stored proceedure to process the delete command.  When I click the delete link, the window refreshes and I receive no errors.  However, the data is not removed.  I've tested the delete command within sql server and it works correctly.  In the code-behind window of Visual Studio, how can I check the parameters being passed to the delete command of the embedded sqldatasource?

Please note, I am able to step through all the events of the parent radgrid and its' associated sqldatasource.  But any of the embedded radgrids and the data sources for them are not visible in the code-behind window.
0
Pavlina
Telerik team
answered on 05 Jul 2011, 11:45 AM
Hello Richard,

Can you please check if the SqlDataSource Deleting event fires when you try to delete item in grid? Another possible reason for the described problem is if the delete parameters are wrong.  Try attaching an event handler to the Deleting event of the grid and inspect the e.Command.Paramaters collection to see what parameters are being sent to the stored procedure and what value they have. In addition, you can also try setting a DefaultValue for the delete parameter of one of the SqlDataSources for the inner grids and see if that deletes the item with the hard-coded ID.

Best wishes,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Richard
Top achievements
Rank 1
answered on 05 Jul 2011, 01:08 PM
That is the problem.  The Visual Studio code-behind window won't recognize the sqldatasource deleting event because it is embedded within the nestedviewtemplate.   I get a compile error when I try to manually set this up.  How can I get around this limitation in Visual Studio?
0
Richard
Top achievements
Rank 1
answered on 05 Jul 2011, 01:21 PM
Never mind... I dind't realize that I could manually assign the 'OnDeleting' event in the .aspx window and then step through the associated sub in the code-behind window.  Your recommendation in your previous post now makes sense.

Thanks!
0
Pavlina
Telerik team
answered on 05 Jul 2011, 03:18 PM
Hello Richard,

After you were able to handle OnDeleting event you can follow the steps provided in my previous post and let me know if they help to find the cause of the problem.

Looking forward for your reply.

Best wishes,
Pavlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Richard
Top achievements
Rank 1
answered on 05 Jul 2011, 03:37 PM
Thanks.  I was able to successfully step through the sqldatasource 'delete' routine and finally figured out why the delete wouldn't work.  Within the MasterTableView of the embedded RadGrid, I had to specify two DataKeyNames since the embedded delete operation required both keys to be explicitly specified before it would recognize the gridcolumn fields.

Interestingly enough, the DataKeyNames weren't required to be specified when the 'Update' operation was called.  Just the 'Delete' operation.

Thanks for the help.

As far as I'm concerned, this can be closed.
0
Pavlina
Telerik team
answered on 05 Jul 2011, 03:48 PM
Hi Richard,

I am glad you were able to resolve the problem. Please so not hesitate to contact us if other questions or problems arise.

Best wishes,
Pavlina
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or