Welcome Guest Search | Active Topics | Sign In | Register

Which event to use after user selects another row of grid? Options
Oscar
Posted: Saturday, May 16, 2009 9:37:16 PM
Rank: Member
Groups: Member

Joined: 5/10/2009
Posts: 16
I want to code some action in VB.NET once the user has clicked on an item. I thought I need use the Grid1_ItemChanged event to detect that the user has clicked on another item. However,
the grid doesn't fire this event since the VS2008 debugger doesn't stop in case I add a breakpoint within the Grid1_ItemChanged event.

So my question is how to find the rownumber after that the user selecter another row.
eo_support
Posted: Sunday, May 17, 2009 8:36:40 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Oscar
Posted: Sunday, May 17, 2009 9:07:37 AM
Rank: Member
Groups: Member

Joined: 5/10/2009
Posts: 16

@There is no server side event when user clicks on an item.???

I can't imagine this to be true. Sophisticated things like suppressing postback, Ajax etc have been implemented but there are no basic server-side events available for the grid like selecting a row? My purpose was to display all item selected data of a record, such as memo fields in other controls since the grid cannot be aimed to hold and show all field data. So I need to find out which recordID the user clicked in order to call another VB.NET subroutine to display the data in other controls.

I have used more competitive grids in the last years but this is the first time that an ASP.NET grid doesn't have server side row and cell selection events at all. Very poor performance, I hope EO will be able to eliminate this lack of feature.
eo_support
Posted: Sunday, May 17, 2009 9:45:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You are not familiar with our Grid yet. You can trigger server side code whenever you need to. However by default almost everything is done on the client side.

The most distinctive advantage of our Grid is that it does not go back to server for most user actions such as selecting, sorting, column reordering even cell editing are all done on the client side. This is not a lack of features. This is a lot of features that are specifically designed for a superior user experience because it is not only much more responsive, but also takes significantly amount of load off your server.

If you do need to go back to the server side, the Grid offers several ways for you to do it. For example, you can use a ButtonColumn, or calls raisItemCommandEvent method on the client side Grid object. You can also initiate an AJAX call from your JavaScript code without going through the Grid to update whatever you need to. You can do this without going through the Grid because everything about the Grid has already been correctly updated on the client side, so it does not need “any help” from the server side to update anything.

Since the default mode is “client mode”, you don’t get the regular server events that you are used to with other Grid ---- the default behavior for other Grids are server event because they lack such rich client side features. For example, when you edit a row, most other Grid must go back to the server to render the edit UI, so you click “Edit” and it takes a second for the page to be updated (noticeably even done through AJAX). With our Grid you click “Edit” it enters edit mode immediately because everything is done on the client side. The same is true for selecting a row. Most other Grid must to go back to the server to re-render the row with a different color to visually indicate the row has been selected. Our Grid does not need to. It changes the color on the client side instantly.

You may want to go over the guide section of the Grid to get a better understanding of the product:

http://doc.essentialobjects.com/library/1/grid/start.aspx

You can take a look of all topics under "EO.Web Grid". That should give you a much better idea of how our Grid works, you will find that this is not the same kind of Grid that you are used to. :)

Thanks!
Oscar
Posted: Sunday, May 17, 2009 10:29:33 AM
Rank: Member
Groups: Member

Joined: 5/10/2009
Posts: 16
Hi eo_support,

The fact is that I've been through this documentation and forum threads and it doesn't reveal to me how to get the grid fire server side event when rows have been selected by the user. It doesn't give sense to have server side properties for cell values griditems available as long as I can't get there by server side coding since there is no event available.

I know that Javascript can give more performance but I also know that it takes far moore time to implement things in javascript and it even might be impossible for all scenarios. Besides that I'd rather prefered my source code not be displayed in such a easy way java scripting does.

So my ultimate purpose is to implement things at server side event processing with the EO grid such I was used to with competitive grids and didn't experience poor performance at all. These grids also feature a rich client set of client side scripting but they also feature server side events. The way you describe the competive grids is definitely not my experience. I've found them working like an Excel grid in the default mode.

Since you claim that 'You can trigger server side code whenever you need to' I'd like to obtain a small aspx example which shows me how to do that. You wrote 'If you do need to go back to the server side, the Grid offers several ways for you to do it.' but all of the the examples that you mention all related to some kind of client side scripting. I don't think myself to be the only user wo is interested in server-side event handling and there is definitely no documentation available how to do that.




eo_support
Posted: Sunday, May 17, 2009 10:43:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You missed the main point of our previous reply. With our Grid, you use client side JavaScript to trigger server side code (most often the server side ItemCommand event). You do not use client side JavaScript to replace whatever logic you were doing on the server side. Those will still be run on the server side. All you are doing is to make a single JavaScript function call to so that the page does go back to the server side to call your code, because by default the Grid does not go back to the server side.

If you are still confused, it might be much better for us to put up a sample and added it to the sample project to demonstrate how to do it rather than just explaining it to you without any code. The code is fairly easy and straight forward but it will certainly involve JavaScript. So if you do not want to deal with JavaScript, then you may want to consider standard ASP.NET DataGrid or GridView, those controls are more server focused.

Thanks!
Oscar
Posted: Sunday, May 17, 2009 10:59:39 AM
Rank: Member
Groups: Member

Joined: 5/10/2009
Posts: 16
Hi eo_support,

I have understood now that it needs a client side Javascript to trigger server side code. As it is easy for you to put up such a sample I think you will please more people to show this functionality in which the user clicks at a specific row which starts a java script routine and the scripts raises a server side event in which it intercepts the specific row number. Thanks in advance.
eo_support
Posted: Sunday, May 17, 2009 11:16:22 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I agree with you. We will try to put up a sample to demonstrate that so that is will be much easier for our users to see how it works.

In the mean time, you may want to take a look of this sample:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\grid_custom_column_adv2

This sample is an advanced sample that is designed for a much more complicated scenario than yours. So it has a lot more code than you would be interested. However it does demonstrate the exact feature we have talked about. You can ignore all the code but only take a look of the following two places:

1. Go to JavaScript tab, search for "grid.raiseItemCommandEvent". That's the JavaScript code that triggers ItemCommand event. The first argument for the function is the item index. Usually when you handle ClientSideOnItemSelect directly, the caller already passed you the item index. You can find another sample about this at here:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\_i12

2. Go to C#/VB tab, search for Grid1_ItemCommand. That's the server side code that handles the event. This sample modifies the Grid cells. You will need to change this code to display whatever other information you want to display. Here you can get the item index from the event argument e;

I would assume that you are quite familiar with step 2 but not quite with step 1. If this is the case, you may want to take a look of the following topic. This topic explains how to use our client side JavaScript interface in general:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Hope this helps.

Thanks
Oscar
Posted: Sunday, May 17, 2009 1:17:39 PM
Rank: Member
Groups: Member

Joined: 5/10/2009
Posts: 16
Hi eo_support,

Thank you very much for the explanations and documentation. I have it working now and I understand the functionality. I have another question now.

After that a row is selected, by raising the server side event, also an annoying postback is performed. Is there a way to prevent the postback by which the page is reloaded? Should I use a callback control for this sake or anthing else?

eo_support
Posted: Sunday, May 17, 2009 5:21:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That's what AJAX does. We support our own CallbackPanel and ASP.NET AJAX. This part has nothing to do with the Grid. So check the documentation for CallbackPanel/ASP.NET AJAX first. If you have never used AJAX before, I would recommend you to use ASP.NET AJAX because there are a lot of online materials/samples about ASP.NET AJAX.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.