Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As pointed out by others, UpdatePanel would be a easier way - but you need to use multiple update panels with <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.updatemode.aspx" rel="nofollow">UpdateMode</a> property set as <code>conditional</code>. Then you can trigger the update-panel refresh using any button on the page (see <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.asyncpostbacktrigger.aspx" rel="nofollow">AsyncPostBackTrigger</a>) or even using java-script (see <a href="http://encosia.com/2007/07/13/easily-refresh-an-updatepanel-using-javascript/" rel="nofollow">this</a> &amp; <a href="http://codeclimber.net.nz/archive/2007/06/26/How-to-refresh-an-UpdatePanel-from-javascript.aspx" rel="nofollow">this</a>). On the server side, you may decide what has triggered the partial post-back and act accordingly by bypassing certain code if not needed.</p> <p>You can also go with your approach - trick here is to capture the page output using <a href="http://msdn.microsoft.com/en-us/library/yw97w238.aspx" rel="nofollow">HttpServerUtility.Execute</a> in your ashx and write it back into the response (see <a href="http://weblogs.asp.net/scottgu/archive/2006/10/22/Tip_2F00_Trick_3A00_-Cool-UI-Templating-Technique-to-use-with-ASP.NET-AJAX-for-non_2D00_UpdatePanel-scenarios.aspx" rel="nofollow">this article</a> where this trick has been used to capture user control output). Only limitation with this approach is that you can only simulate GET requests to your page and so you may have to change your page to accept parameters via query string. Personally, I will suggest that you create a user control that accept parameters via method/properties and will generate necessary output and then use the control on your page and in ashx (by dynmaically loading it in a temperory page - <a href="http://samuelmueller.com/2008/12/dynamicloader-plugin-dynamically-loading-asp-net-user-controls-with-jquery/" rel="nofollow">see this article</a>).</p> <p>EDIT: I am using jquery to illustrate how to do it from grid-row-view.</p> <pre><code>$(document).ready(function() { $("tr.ajax-grid-row").click(function() { $("#hidden-field-id").val($(this).find(".row-id").val()); // fill hidden filed $("#hidden-button-id").click(); // simulate button click }); }); </code></pre> <p>You can place above script in the head element in markup - it is assuming that you have decorated each grid-row-view with css class "ajax-grid-row" and each row will have hidden field decorated with css class "row-id" to store row identifier or the value that you want to pass to server for that row. You can also use cell (but then you need to use innerHTML to get the value per row). "hidden-field-id" and "hidden-button-id" are client ids for hidden field and submit button - you should use <code>Control.ClientID</code> to get actual control ids if those are server controls.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload