Lives: 30

New Grid Feature: CallbackParameter

Posted Wed Dec 19, 2007 @ 3:26 PM

A common scenario that our users encounter with the Grid is the need to populate it with different data depending on client-side context – for instance, a dropdown option or a TreeView selection. Very often, this situation is solved by to setting Grid to Server or Client running mode and wrapping it in a CallBack control, and then using the CallBack to send custom parameters back to the server and to refresh the Grid.

This has worked well for many, but is not without its limitations, mostly having to do with CallBack’s inability to maintain state across callbacks. It also seems somehow wrong and wasteful to approach things this way and completely ignore Grid’s own ability to issue callbacks, and maintain its own state.

To remedy this slightly awkward situation, we’ve introduced and small (but hopefully important) new feature to Grid as part of Web.UI 2007.2 SP1: the CallbackParameter property. This property can be set on the server or the client, and is sent back with every callback issued by the Grid. A Grid in CallBack running mode exposes this value on the server in time for every server-side event, and the value will mirror that on the client. So, where before we may have done something like this:

CallBack1.callback(‘mailbox’);


we would now do away with the CallBack control altogether, and do this instead:

Grid1.set_callbackParameter(‘mailbox’);
Grid1.callback();


Conditional logic on the server can then do the right thing based on the value of Grid1.CallbackParameter. To further facilitate this parameter-based loading, we’ve added two more server-side Grid events: BeforeCallback and AfterCallback. These are raised before and after (respectively) all the other events raised during a Grid callback request.

Hope you find this useful! Let us know what you think.



Note: This feature is available as of Grid 2007.2 SP1, available Dec 17. 2007.

Posted to Milos Glisic by milos

Posted on Wed Dec 19, 2007 @ 3:26 PM

Filed under: , , , ,

Comments

Wow!! In the nick of time...
Posted on Wed Dec 19, 2007 @ 3:26 PM
I checked out the blog for the first time out of curiosity to see if there was anything useful here and came across this. When just yesterday I had to a work-a-round to get the functionality mentioned in blog. Thanks for the info.
Shayane Umar
Posted on Wed Dec 19, 2007 @ 3:26 PM
1-I have a question here, if i use thiis property in call back method what will be the behavour. 2-I have a grid running in client mode and i m in the same situation of refreshing grid content based on one client event, I tried using this property on the grid it brigs only one page worth of data. Any clue how can i do this.
Brad Fultz
Posted on Wed Dec 19, 2007 @ 3:26 PM
I have reviewed your Outlook 2007 expample. Is it possible to use this new feature to actually change to a new data source that has a different schema? different columns?). I can get the older methods to change the datasource, but I cannot get the header(columns list) to change client-side. The grid display the new data, but with the old column definition.
Milos
Posted on Wed Dec 19, 2007 @ 3:26 PM
Brad: Grid's callbacks can only be used to fetch data, and update some basic properties like CurrentPageIndex. However, we are planning to add the ability to configure the Grid (column definitions, styles, etc) via web service calls, which sounds like what you'd want to use.
Bhupesh Mohan
Posted on Wed Dec 19, 2007 @ 3:26 PM
Hi, This is Bhupesh from South Africa. I read all the articles that you have written in this blog. I am having some queries regarding drag and drop functionalities, Hope you will help or guide to me, I have searched so many articles, but that all not related to this task. In the ComponentArt TreeView Control is having the multiple select drag and drop functionalities(for example: If the drag the parent node then it will drag all the child nodes too) I want to create the same functionalities without Treeview Can you please guide me, What is the logic behind? and how we can achieve this? Thanks in Advance... With thanks and regards, Bhupesh Mohan
Akanksha
Posted on Wed Dec 19, 2007 @ 3:26 PM
Hi, Can anyone tell me how we can bind the datasource to a componentart grid using the ASP .Net MVC Framework. I mean without having any code behind files, can we retrieve the data from the controller and bind the same to the component art grid?? Any help on this is greatly appreciated. Its an urgent requirement.
Anonymous comments are not allowed. Click here to log in or create an account.

Copyright © 2010 ComponentArt, Inc. All rights reserved.