Welcome Guest Search | Active Topics | Sign In | Register

Grid Row Double Click Event??? Options
Dave
Posted: Monday, April 7, 2008 5:25:55 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Do you have any sample code for a double click event on a Grid Row???? I'm not refering to just the selected row changing but an actual double click event on the selected row.

Thanks,

Dave
eo_support
Posted: Monday, April 7, 2008 5:42:01 AM
Rank: Administration
Groups: Administration

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

Unfortunately double click is not directly supported on the Grid yet, we will look into it and see if we can add that.

Thanks
Dave
Posted: Monday, April 7, 2008 8:30:58 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
how about selected row changed????
eo_support
Posted: Monday, April 7, 2008 8:36:36 AM
Rank: Administration
Groups: Administration

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

That's already there. Check ClientSideOnItemSelected/ClientSideOnCellSelected.

Thanks
Dave
Posted: Monday, April 7, 2008 8:51:48 AM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Yes... But what if I want to work on the codebehind page with this event???? Any sample code would be appreciated.
eo_support
Posted: Monday, April 7, 2008 9:03:18 AM
Rank: Administration
Groups: Administration

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

The Grid does not do that automatically because it is very rare that people want the Grid to post back to the server when an item or cell is selected. It however provides a function for you to do it:

http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Grid.raiseItemCommandEvent.html

Please keep in mind that this function is for you to raises server side item command event. You call it whenever you want to, so It is not directly tied to item select event.

To do that you can start with this sample:

http://www.essentialobjects.com/Demo/Default.aspx?path=Grid\_i1\_i15

Take a look of the OnItemCommand client side JavaScript handler and you can then replace window.alert() to a call of this function. It will be something like this:

Code: JavaScript
function OnItemCommand(grid, itemIndex, colIndex, commandName)
{
    grid.raiseItemCommandEvent(itemIndex, commandName);
}


That will trigger ItemCommand server side event for you.

Hope this helps.

Thanks
Dave
Posted: Monday, April 7, 2008 12:36:28 PM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
I guess I'm not getting my point across..... This app has a lot of C# codebehind. I simply need to get at the selected row data on the codebehind page. I don't follow how I can use "grid.raiseItemCommandEvent(itemIndex, commandName);" to do that. If so please elaborate......

eo_support
Posted: Monday, April 7, 2008 12:58:33 PM
Rank: Administration
Groups: Administration

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

Then you would be looking for these two properties:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.Grid.SelectedItemIndex.html
http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.Grid.SelectedCellIndex.html

raisesItemCommandEvent fits another purpose which I'll try to explain below. A "normal" flow would be like this:

1. You set SelectedItemIndex/SelectedCellIndex in your code behind;
2. The Grid is rendered to the client side;
3. User interacts with the Grid, select/edit row/cells, this can occur multiple times;
4. user submit the page (along the changes) by clicking something else, for example, a "Submit" button;
5. You are back to the server again and you can now use SelectedItemIndex/SelectedCellIndex to get the last selected item/cell;

The most important points in this flow are:
1. On step 3, user can select/edit row/cells multiple times. This means user can change values in multiple rows without going back to the server;
2. On step 5, all these changes are submitted to the server by another control (a "Submit" button for example), not the Grid itself;

In a sense the Grid works like a simple text box. It's there allow you to type and retype multiple characters before you are ready to submit.

However if you are not happy with this "normal" flow, you are free to go back to server any time. For example, you can program the grid to go back to the server on step 3 as soon as user changed the selected row. You go back to server by calling raisesItemCommandEvent. The Grid only provides you a way to do it, whether to call it and when to call it would be completely up to you.

Hope this clears up.

Thanks
Dave
Posted: Monday, April 7, 2008 3:04:44 PM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Sorry I was being a bit thick headed before...... But still having problems.

Here's the code:

sPayrollNum = employeeGrid.Items[employeeGrid.SelectedItemIndex].Cells["payroll"].ToString();

It always returns the string "EO.Web.GridCell"

The cell is named "payroll" and I've checked that "employeeGrid.SelectedItemIndex" has the correct value for the selected row. What am I doing wrong????
Dave
Posted: Monday, April 7, 2008 3:06:09 PM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Let me correct.....

The column is named "payroll"
eo_support
Posted: Monday, April 7, 2008 3:28:47 PM
Rank: Administration
Groups: Administration

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

You need to use Cells["payroll"].Value instead of Cells["payroll"].ToString(). When you are not certain about which one to use, it would be a good idea to take a look of our documentation, which is provided in the form of a .chm help. Go to "Server API Reference" section and you will see everything there.

Thanks
Dave
Posted: Monday, April 7, 2008 3:57:15 PM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Thanks.... Funny thing though, there is no documentation on the "Value" property
Dave
Posted: Monday, April 7, 2008 3:58:20 PM
Rank: Advanced Member
Groups: Member

Joined: 4/4/2008
Posts: 46
Ooops yes there is.... Thanks again.
Ria
Posted: Wednesday, April 16, 2008 2:00:21 PM
Rank: Advanced Member
Groups: Member

Joined: 6/6/2007
Posts: 37
I have two buttoncolumns in my grid, with of course two commands

when i use this function
function OnItemCommand(grid, itemIndex, colIndex, CommandName)
{
grid.raiseItemCommandEvent(itemIndex, CommandName);
}

I get a server Grid1.ItemCommand the valur of the itemindex is correct but the commandname = ""

what do i do wrong?
eo_support
Posted: Wednesday, April 16, 2008 2:27:34 PM
Rank: Administration
Groups: Administration

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

That appears to be a bug. We will fix it as soon as possible.

Thanks
eo_support
Posted: Thursday, May 1, 2008 1:54:20 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
This issue has been fixed as of build 2007.2.51.


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.