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

Custom Forms in RadGrid when you don't have an aspx page

5 Answers 94 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Michael Malone
Top achievements
Rank 1
Michael Malone asked on 11 May 2010, 07:42 PM
Since I'm developing my user interface elements as WebParts (class libraries) in MOSS 2007, I don't have the luxury of an .aspx page. And without an aspx page, i have to try and convert the declarative examples found on this site to work programmatically. I'm having a difficult time trying to create a custom form in a RadGrid using my own controls instead of using the auto-generated form provided by the RadGrid itself. One way I've seen this is through the use of Templates where you provide your own form to the "MasterTableView.EditFormSettings.FormTemplate". I can't find an example where this is all handled programmatically. In this situation, is it preferred that I just use the RadGrid to display a list and redirect the user to another page where the form will reside, passing the primary key as part of the query string? Or should I write my form as a class that inherits from "System.Web.UI.ITemplate" and set my RadGrid's "FormTemplate" to this class? I like the template route but I can't seem to find any good examples.

A basic example would be a RadGrid with a few rows of data... the user clicks the "Edit" button and my custom form will display itself as a "GridEditMode.PopUp". 

5 Answers, 1 is accepted

Sort by
0
Accepted
Sebastian
Telerik team
answered on 12 May 2010, 09:00 AM
Hello Michael,

How to create FormTemplate custom edit form programmatically you can see from the following help article in RadGrid's documentation (see the bottom section). You can use it either as an "internal" edit form or popup edit form for your grid instance (by specifying EditMode="PopUp" for your MasterTableView).

Best regards,
Sebastian
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
Michael Malone
Top achievements
Rank 1
answered on 12 May 2010, 02:49 PM
Thanks for the example, that has gotten me to a good start... one question, what's the advantage of implementing the "ExtractValues" method of IBindableTemplate and then having to call "FindControl" to retrieve values rather than just declaring your controls as member variables of the IBindableTemplate class and checking their values directly? 
0
Sebastian
Telerik team
answered on 12 May 2010, 02:56 PM
Hi Michael,

The advantage of the ExtractValues method is that it can be invoked for the corresponding GridEditableItem to fetch the data from the column editors without referencing them explicitly. The alternative option would be to locate the editors with the FindControl method and get the new values from them.
 
Regards,
Sebastian
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
Michael Malone
Top achievements
Rank 1
answered on 12 May 2010, 09:19 PM
"The advantage of the ExtractValues method is that it can be invoked for the corresponding GridEditableItem to fetch the data from the column editors without referencing them explicitly"

Is there a performance benefit from not referencing them explicitly? I guess I don't fully understand why it's recommended to use IBindableTemplate (which requires the "ExtractValues" method) instead of ITemplate which does not.
0
Michael Malone
Top achievements
Rank 1
answered on 12 May 2010, 09:54 PM
Nevermind... I see now that by implementing IBindableTemplate, I can call GridEditableItem.ExtractValues from an UpdateCommand event to extract my values. Thank you.
Tags
Sharepoint Integration
Asked by
Michael Malone
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Michael Malone
Top achievements
Rank 1
Share this question
or