I have ajax enabled on my grid. I'd like to force a full page postback after a new row is added. Is there a way to do this?
Tony,
I did the following with AfterRowInsertHandler...
ClientSideEvents-AfterRowInsertHandler="AfterInsert"
function AfterInsert(gridName, rowId) { var row = igtbl_getRowById(rowId); row.processUpdateRow(); __doPostBack(null); }
This works well. I click on the Add Row button. The grid adds a new row, then updates (saves) the record, then does a postback. I see the new identity value in the identity column. Now the only remaining issue is that after the postback the last row that was just inserted is kinda hiding. You have to scroll down to see it. I wish there was a way to bring focus to the last row after any postback.
Tony Lombardo"]There are a couple of ways I can think of off the top of my head. The first would be to use the BeforeXMLHTTPRequest client-side event that the WebGrid fires before any AJAX interaction - http://help.infragistics.com/NetAdvantage/NET/2008.3/CLR3.5 When you handle this event, you can cancel the request if the action was a new row added, and call __doPostBack manually instead.
There are a couple of ways I can think of off the top of my head. The first would be to use the BeforeXMLHTTPRequest client-side event that the WebGrid fires before any AJAX interaction - http://help.infragistics.com/NetAdvantage/NET/2008.3/CLR3.5
When you handle this event, you can cancel the request if the action was a new row added, and call __doPostBack manually instead.
Ok, tried #1. Strange thing is that BeforeXMLHTTPRequest only seems to fire for Updates but not when a new row is inserted. The following function would only give me hi7 (update) and no hi5(add new row):
function BeforeXmlHttpRequest(gridName, type) { alert('hi' + type); }
Also tried dopostback with ClientSideEvents-AfterRowInsertHandler. It would indeed postback when I clicked on the Add Row button but won't give me a new row after the postback.
Tony Lombardo"] The second option would be to handle this from the server-side. When you handle the RowAdded server-side event, emit a scriptblock that calls __doPostBack on the client-side. This would force the client to first complete the add asynchronously, and then perform a full postback.
The second option would be to handle this from the server-side. When you handle the RowAdded server-side event, emit a scriptblock that calls __doPostBack on the client-side. This would force the client to first complete the add asynchronously, and then perform a full postback.
Sorry don't know where/how exactly to handle the RowAdded server-side event? Is there any sample code. Right now my aspx.vb page just has an empty sub:
Protected Sub UltraWebGrid1_AddRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles UltraWebGrid1.AddRow End Sub
Any code I put in there doesn't do anything.
Thanks for trying to help out Tony!
Regards,Ali
P.S. Is there a way to initiate rowupdate from the ClientSideEvents-AfterRowInsertHandler? Then I could immediately do a postback after update.
Hope this helps,
-Tony