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

6 posts, 1 answers
  1. Michael Malone
    Michael Malone avatar
    68 posts
    Member since:
    May 2010

    Posted 11 May 2010 Link to this post

    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". 
  2. Answer
    Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 12 May 2010 Link to this post

    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.

  3. Michael Malone
    Michael Malone avatar
    68 posts
    Member since:
    May 2010

    Posted 12 May 2010 Link to this post

    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? 
  4. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 12 May 2010 Link to this post

    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.
  5. Michael Malone
    Michael Malone avatar
    68 posts
    Member since:
    May 2010

    Posted 12 May 2010 Link to this post

    "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.
  6. Michael Malone
    Michael Malone avatar
    68 posts
    Member since:
    May 2010

    Posted 12 May 2010 Link to this post

    Nevermind... I see now that by implementing IBindableTemplate, I can call GridEditableItem.ExtractValues from an UpdateCommand event to extract my values. Thank you.
Back to Top