Our application has a couple of heavy grids (lots of fields and rows). Even with paging, limiting the rows, etc this is still a lot of data to download to the client.
We are using the RowEditTemplate as a quick way to display all of the records details (no editing). In several grids we display the key, its description and a couple of important fields. Then the RowEditTemplate displays the full records data (several code and description fields, quantities, etc). Currently these are included in the grid as hidden columns.
What I would like to do is perform an AJAX postback when the template opens and use that to populate most of the fields in the RowEditTemplate. However when trying to do this (what seems like an easy task) I keep running into problems like control registration, page control event validation, update panel not firing correctly, etc.
Does anyone have any ideas or have you done this in the past?
<RowEditTemplate>
<asp:UpdatePanel ID="upGridRow" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
... lots of fields and a hidden button to perform the AJAX call ...
</ContentTemplate>
</asp:UpdatePanel>
</RowEditTemplate>
p.s. Yes I know I could easily just call a popup form that displays the records details.
It would likely be easier for you to call a popup (such as a WebDialogWindow) in this scenario.
The row edit template of WebGrid does not contain any "instance" information when on the server. Its built-in functionality is to use JavaScript to copy data from corresponding cells in the WebGrid from the row being edited. On the server, the template essentially "doesn't exist," for purposes of putting data into it. This is why your UpdatePanel isn't working.
If you wanted to do this via AJAX, you'd likely have to write your own custom AJAX to place the request and process the response. The UpdatePanel can't directly assist in this, if it's placed inside the row edit template.
Do you already have all of the data you need in the grid itself? If so, then no AJAX should be necessary at all. You can to copy that data from the grid cells into the row edit template when the template is opened, and back when the template is closed - and that's assuming that the grid doesn't do this copying for you automatically.