Any way to NOT use hidden inputs for meta data?

4 posts, 0 answers
  1. Xorcist
    Xorcist avatar
    92 posts
    Member since:
    Apr 2009

    Posted 20 Mar 2013 Link to this post

    I'm a little new to using the Telerik Ajax stuff, so maybe there is a completely different method for what I want to do, but...

    Using a standard RadAjaxManager and RadAjaxPanel, is there any way to send/return extra information to/from the server without having a specific control defined to hold the extra data (i.e. asp:HiddenField).

    I've used jQuery before to call WebMethods and I can return whatever I like in the JSON, even if I don't use it to update my page. But in this instance, I have an app that is already using the aforementioned RadAjaxManger and RadAjaxPanel to insert/update/delete data in a database, but I would like to return some metadata that I can use to determine if the operations occurred without issue (mainly validation issues). But I was hoping there was a better way than created N number of asp:HiddenFields for each and every RadAjaxPanel that exist in the app.

    So is there any way to do what I'm asking?


    P.S. How is it that these Telerik Ajax operations can happen without WebMethod being specified? Is the page doing a full postback with all the page data (i.e. ViewState) in it, but just returned the pieces that were supposed to get updated?
  2. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 25 Mar 2013 Link to this post

    Hi John,

    In order to achieve your scenario you could use a custom attribute on the RadAjaxPanel as shown in the example below. Note that there is no build in mechanism to handle such cases and custom implementation is required either using a ASP.NET HiddenField as you have described or using custom attributes.
    RadAjaxPanel1.Attributes.Add("data-metadata", "yourdata");

    Regarding the question about the ajax operations: The idea behind the ASP.NET Ajax is performing ajax request by sending the page data to the server and executing the whole page life cycle but returning only the html parts that have been wrapper by an UpdatePanel.

    Kind regards,
    Antonio Stoilkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Xorcist
    Xorcist avatar
    92 posts
    Member since:
    Apr 2009

    Posted 25 Mar 2013 Link to this post

    Looks like the attributes are fine for receiving data without an extra control. But updateing them on the client side (say in an asp:Panel) will not update the viewstate and as such do not carry across to the server side. Is there any way to achieve this as well? Maybe with a client-side Telerik panel of some sort, I couldn't find a RadPanel anyway out side of WinForms implementation.

    And a few of my pages have very large and or multiple grids on them, so sending the entire page back to the server is complete overkill when realistically I might just need to validate a single textbox on the page... do I just have to fall back on using jQuery for these cases and manually code all the bits for what controls need updating on response?

    I was kinda under the impression that the RadAjaxManager was different than an UpdatePanel and wouldn't have it's associated horrible overhead.
  5. Antonio Stoilkov
    Admin
    Antonio Stoilkov avatar
    530 posts

    Posted 28 Mar 2013 Link to this post

    Hello John,

    In the case where attributes does not help you in achieving your scenario I would recommend using a HiddenField control for the data. Note that all RadControls are using the same mechanism (HiddenField inputs) to store client-side data and send it back to the server.

    Additionally, the RadAjaxPanel and RadAjaxManager build upon the UpdatePanel features. Internally both of Telerik ajax controls are using UpdatePanel controls. You are correct in your observations that ASP.NET ajax design presents overheads in some scenarios. However, in most cases it could do great job with little effort - other more advanced cases should be handled individually by the developer.

    All the best,
    Antonio Stoilkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top