Rank: Newbie Groups: Member
Joined: 7/20/2009 Posts: 6
|
I would like to raise an event when a row is selected in the Grid control by clicking a button or link.
The Code-Behind page includes the event below, but the ItemChanged event doesn't seem to be getting raised. What causes the ItemChanged event to occur? I have been able to detect a row being selected by using a client-side JavaScript function, but I don't know how to make the function transfer to a different web page.
Protected Sub Grid1_ItemChanged(ByVal sender As Object, ByVal e As EO.Web.GridItemEventArgs) Handles Grid1.ItemChanged
'Get the currently selected row. Dim intRow As Integer = Grid1.SelectedItemIndex
Session("CurrentProductID") = Grid1.Items(intRow).Cells(1).Value lblDisplay.Text = "Item Changed Event: CurrentProductID = " & Session("CurrentProductID")
Server.Transfer("ProductUpdate.aspx")
End Sub
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
ItemChanged event is a delayed event. It is similar to a TextBox's TextChanged event. The TextChanged event does not occur when you type and change the text. It occurs after you submit the page. ItemChanged event works the same way. It is triggered after you submit the page. How you would submit the page is a totally different issue, you can submit with a Button, from JavaScript, or even by a timer.
The Grid client side API does provide raisesItemCommandEvent function for you to submit the page and also raises server side ItemCommand event. A ButtonColumn can be used to call this method. Our latest build also include a separate ScriptEvent control can also submit the page for you. You can use any of those method. The key is to post the page back to the server.
Thanks!
|