Ajax in EditForm Template

2 posts, 1 answers
  1. chairmaker
    chairmaker avatar
    14 posts
    Member since:
    Jul 2008

    Posted 02 Feb 2010 Link to this post

    Trying to develop my first serious app using Telerik. 

    Ok so far, but I'd like to use the Ajax capabilities within the editform template so i can load controls based on the user selections made in other controls, and so on.  In most cases I need to go back to the server for data, and I would prefer to do this server-side in C#/Linq.

    I've added a RadAjaxManagerProxy to the template (have a RadAjaxManager on the master page) and can see the components on the template from the ajax manager's config. window.  However, no events are fired until the whole form is submitted, which is not the behaviour I need.

    1.    is ajax available within a form template? 
    2.    If so, how do I set it up?

    Many thanks,

    p.s. this is probably a real 101 question, but I'm used to Windows development.  ASP.Net is a real culture shock!
  2. Answer
    Tsvetoslav avatar
    1823 posts

    Posted 05 Feb 2010 Link to this post

    Hello Peter,

    If you need just the edit form to be ajaxified - this is not a supported scenario since the edit form is part of the grid and when you put the grid in an UpdatePanel or ajaxify it through the RadAjaxManager control (which is essentially the same since what the RadAjaxManager does is to create update panels around its ajaxified control) you are effectively putting the edit form as well.

    If you need some of the controls on the edit form to fire ajax requests, then you can obtain a reference to those controls in the ItemCreated event of the grid and set their AutoPostBack property to true. For example, if you have a column "Country" and you need the textbox for this column in the edit form to fire an ajax request, then you should do the following:

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
              if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                 ((TextBox((GridEditableItem)e.Item).Controls[0]).AutoPostBack = true;

    I hope this helps.

    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top