|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
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
|
|
Rank: Advanced Member Groups: Member
Joined: 4/4/2008 Posts: 46
|
how about selected row changed????
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi,
That's already there. Check ClientSideOnItemSelected/ClientSideOnCellSelected.
Thanks
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
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\_i15Take 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
|
|
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......
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi, Then you would be looking for these two properties: http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.Grid.SelectedItemIndex.htmlhttp://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.Grid.SelectedCellIndex.htmlraisesItemCommandEvent 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
|
|
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????
|
|
Rank: Advanced Member Groups: Member
Joined: 4/4/2008 Posts: 46
|
Let me correct.....
The column is named "payroll"
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
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
|
|
Rank: Advanced Member Groups: Member
Joined: 4/4/2008 Posts: 46
|
Thanks.... Funny thing though, there is no documentation on the "Value" property
|
|
Rank: Advanced Member Groups: Member
Joined: 4/4/2008 Posts: 46
|
Ooops yes there is.... Thanks again.
|
|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
Hi Ria,
That appears to be a bug. We will fix it as soon as possible.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,218
|
This issue has been fixed as of build 2007.2.51.
|
|