This is a migrated thread and some comments may be shown as answers.

Grid Binding against a webservice issue

2 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jaime Alberto Jaramillo Zapata
Top achievements
Rank 2
Jaime Alberto Jaramillo Zapata asked on 22 Sep 2009, 04:06 PM
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?
Cheers

2 Answers, 1 is accepted

Sort by
0
Todd Anglin
Top achievements
Rank 2
answered on 23 Sep 2009, 03:10 AM
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.
-Todd
0
Jaime Alberto Jaramillo Zapata
Top achievements
Rank 2
answered on 24 Sep 2009, 04:14 PM
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
Tags
Grid
Asked by
Jaime Alberto Jaramillo Zapata
Top achievements
Rank 2
Answers by
Todd Anglin
Top achievements
Rank 2
Jaime Alberto Jaramillo Zapata
Top achievements
Rank 2
Share this question
or