Grid Binding against a webservice issue

3 posts, 0 answers
  1. Jaime Alberto Jaramillo Zapata
    Jaime Alberto Jaramillo Zapata avatar
    10 posts
    Member since:
    Feb 2009

    Posted 22 Sep 2009 Link to this post

    Hi there
    Im currently working on  grid binded against a webservice
    The grid has a couple of columns GridEditCommandColumn and the second one is a GridButtonColumn.
    When I press any of those commands it does not fires the postback (the on_row_command). Instead It calls the webservice again and binds the data.
    I was wondering if tis possible to fire the postback in this scenario?
  2. Todd Anglin
    Todd Anglin avatar
    2040 posts
    Member since:
    Aug 2005

    Posted 22 Sep 2009 Link to this post

    Hello Jaime-

    Sorry to hear you're having trouble. In this case, I -think- (I'll have to verify) that it is not possible to have GridButtonColumns (or buttons in general) fire a PostBack when binding to web services. The whole idea with web services is that you're sending JSON over the wire and building the UI client-side ("clean, client-side HTML"). As such, I don't think the HTML rendered after client-side binding includes the hooks for ASP.NET page postbacks.

    Further, performing a row PostBack with web service binding could produce some unexpected results. Client-binding does not participate in ViewState (something usually key to support ASP.NET PostBack operations), so you'd probably hit problems even if you managed to wire-up the PostBack event with JavaScript.

    If you need the PostBack, I'd suggest using a RadGrid bound "normally" to a ObjectDataSource or SqlDataSource and then using RadAjaxManager to optimize the user experience. It won't be as efficient over the wire as web services, but it will be much easier to use PostBack actions if you need them.

    The other option is to replace your PostBack actions with new JavaScript functions that call web services and perform operations "cleanly" (rebinding from your web service after the operation is complete). This approach is efficient over the wire, but will take more coding time up front.

    Hope that insight helps. If you get stuck, let me know and I'll be happy to assist.
  3. Jaime Alberto Jaramillo Zapata
    Jaime Alberto Jaramillo Zapata avatar
    10 posts
    Member since:
    Feb 2009

    Posted 24 Sep 2009 Link to this post

    Thank U!
    I also considered that it might get viewstate sycn issues using the client bind technique...
    Anyways If you find something let me know
    Again , thank you
Back to Top