jvwiv Posted July 21, 2008 Report Share Posted July 21, 2008 Is there a way to programatically refresh items in the grid like the user can when he clicks on the Refresh items button associated with the grid? Quote Link to comment Share on other sites More sharing options...
StephenP Posted July 21, 2008 Report Share Posted July 21, 2008 Would you like client-side JavaScript or the server-side C#/VB? Quote Link to comment Share on other sites More sharing options...
jvwiv Posted July 21, 2008 Author Report Share Posted July 21, 2008 Client side Java script would be nicest, but vb is where I'm already executing code (ExecutingCustomCommand) so that would work as well... Thanks for the help! Quote Link to comment Share on other sites More sharing options...
StephenP Posted July 22, 2008 Report Share Posted July 22, 2008 The client-side javascript is different for grids depending on their ID. So, we include a server-side method that generates the javascript for you. In VB, just enter: Grid1.Commands.RefreshData.GetExecuteScript() Grid1 in that case is the grid in question. It will spit out javascript like: GridFX.Grid.get_grids().Grid1.refreshData();That will do the trick. Quote Link to comment Share on other sites More sharing options...
jvwiv Posted July 23, 2008 Author Report Share Posted July 23, 2008 Hi Stephen, I've added the Grid1.commands.refreshdata.getExecuteScript() in the executecustomcommand for the grid method in the code behind. The line gets executed, but no post back occurs during the firing of the event. The event does not generate the Java code on the page. (view source after firing the event) Here's what I'm trying to do. I have 2 grids on the form. When the user clicks a button on grid 1, the record from that grid is put into a table that is mapped to grid 2. So, I have vb code associated with that custom command button. The record gets added but the grid doesn't refresh until I manually click on the gridfx refresh button. Quote Link to comment Share on other sites More sharing options...
StephenP Posted July 23, 2008 Report Share Posted July 23, 2008 Okay, so you are trying to update 2 "sibling" grids. That's another story. Unfortunately at this time, a grid that initiates a callback can only update within itself. ASP.NET provides basically no support for more advanced updating within callbacks (UpdatePanels actually use postbacks, not callbacks, and are very heavy things). We are in the process of improving this, and in upcoming releases of our products you will be able to update many separate controls during a callback. Until then, you are best off just using a regular <asp:Button and handling its click event. This will use a postback and although the flickering will occur, your problem should be solved. You may need to call DataBind on the second grid, because it has no official way to know that its data depends on another. Hope this helps! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.