ChildActionOnly for grid datasource

4 posts, 0 answers
  1. Talal
    Talal avatar
    3 posts
    Member since:
    Apr 2015

    Posted 09 May 2015 Link to this post

    I want to apply [ChildActionOnly] attribute to the action method used by kendo ui grid DataSource as in 

    .DataSource(dataSource => dataSource           
                .Ajax()
                .Read(read => read.Action("Read", "Conrtoller")) 

     

    but when I apply [ChildActionOnly] to Read(), everytrhing stops working

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 12 May 2015 Link to this post

    Hello Talal,

    The ChildActionOnly attribute ensures that an action method can be called only as a child method from within a view. This attribute prevents the action methods from being invoked as a result of a user request.

    Regards,
    Boyan Dimitrov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. Talal
    Talal avatar
    3 posts
    Member since:
    Apr 2015

    Posted 12 May 2015 in reply to Boyan Dimitrov Link to this post

    Thanks. But, how else do I ensure that this action method cannot be invoked via a URL.
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 14 May 2015 Link to this post

    Hello Talal,

    By default the request's type to the server for read operation should be "POST". Invoking the method via URL should send a "GET" request to the server and throw an error eventually.

    Please take a look at the attached example.   

    Regards,
    Boyan Dimitrov
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top