Welcome Guest Search | Active Topics | Sign In | Register

Grid Firing Server Event Options
ROI.Solutions
Posted: Friday, May 9, 2008 2:19:34 PM
Rank: Advanced Member
Groups: Member

Joined: 4/22/2008
Posts: 75
OK,

I will start off syaing i know this may not be something you fully support but an example would be great. I know the grid works well with JS when user clicks things. but i need to update a Database table without having to do a post back. Example i have a button column call Delete. What i want to happen is when they click Delete fro me to be able to sense that in the VB code behind my ASPX page. I have the JS onItemCommand working with poping a new window with Google. I say heard there was a way to raise it so that i can use the VB code behind he page connect to my DB and delete the row. Is this possible to have the onClinet Click ItemCommand run or call a VB code sub method with your grid?
ROI.Solutions
Posted: Friday, May 9, 2008 2:56:56 PM
Rank: Advanced Member
Groups: Member

Joined: 4/22/2008
Posts: 75
OK i think i have gotten it to work with the button Column Sample code below

Code: Visual Basic.NET
Public Sub Test(ByVal sender As Object, ByVal e As EO.Web.GridCommandEventArgs) Handles sAssociationGrid.ItemCommand
        MsgBox("Hi", MsgBoxStyle.Critical)
    End Sub


Had to go throuhg like hundreds of pages in the Online Documents before i could find it. There should be a search feature on that bad boy :). Now i havent found out how to d this with a clickevent on the checkbox one? how does one determine if a user has clicked the checbox?
eo_support
Posted: Friday, May 9, 2008 3:05:49 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi Loren,

First of all some background information. For any server side code to be called, you will have to go back to the server, usually through a post back. So "i need to update a Database table without having to do a post back" is not possible. However post back and full page reload are two different things. Post back means to a request being send to to the server; full page reload means the new page contents is regenerated by the server, transferred to the client and reloaded by the browser. These two almost always occur together (a request sent to the server -> server regenerates page contents -> new contents sent to the client -> client browser load the new contents, AKA "roundtrip") with the exception of AJAX. When AJAX is involved, the last step (client browser load the new contents) is different. Instead of loading the full page, it loads a part of it. thus the name of "partial update". In another word, you do not try to avoid a postback, you try to avoid a "full page reload".

When it comes to the Grid, when you want to call server side code, you would do it inside your ClientSideOnItemCommand handler (the JavaScript function called by the Grid when you click the button), instead of poping up a new window with Google, you would do something like this:

Code: JavaScript
function  your_itemcommand_handler(grid, itemIndex, colIndex, commandName)
{
    //I assume that you were poping up window at here. You will
    //need to remove that code and add the following code

    grid.raiseItemCommandEvent(itemIndex, commandName);
}


raiseItemCommandEvent "raises ItemCommand event", which means:

1. It post backs the page;
2. It calls the Grid's ItemCommand event on the server side;
3. The Grid is regenerated and transfered to the client side;
4. The Browser reload the Grid;

As you can see, a full post back does occur. But this is the first step that must be taken if you need any server side code to be called. Once you are there, you can look into AJAX solutions (either Callback mode natively supported by the Grid, or CallbackPanel control, or ASP.NET AJAX) to reach your final goal.

Hope this helps.

Thanks
ROI.Solutions
Posted: Friday, May 9, 2008 3:28:26 PM
Rank: Advanced Member
Groups: Member

Joined: 4/22/2008
Posts: 75
Yes this Help tremendously. Now I noticed your CheckBox Column doesn have any kind of Command Event if echedk is this somehting you possibl plan to add? as it would make things easy when use clicks a check and uncheck a check box rather than a button. as for the RasieItemCommand is there a way to edit it to be able to also send the Grid and ColIndex?
eo_support
Posted: Friday, May 9, 2008 5:35:06 PM
Rank: Administration
Groups: Administration

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

We have looked into checkbox column command event question. As it is implemented now it does not trigger any kind of command event --- just as you have noticed.

We believe it makes sense to have an option of triggering server event when a checkbox is clicked, however the way it is triggered may to be different than a button because checkbox has an additional value indicating "checked" or "unchecked", where a button column does not. So even if we add such an option, most likely you will not be looking ItemCommand event. Thus we still need some time to work out the details on this one. We will update once additional information is available.

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.