Hi,
I have an UltraWebGrid with a column "Delete", column type = Infragistics.WebUI.UltraWebGrid.ColumnType.Button. When the user clicks in the button, I delete the row (from DB, so it is server side). I want to add a confirmation message to ask to the user for confirmation before deleting the row. I want to do it in the client-side. I tried using AJAX but I didn't find the way to use it in UltraWebGrid. Also, I tried using the DisplayLayout.ClientSideEvents.CellClickHandler and others properties but I couldn't solve my problem.
(Note: I have the UltraWebGrid inside a WebAsyncRefreshPanel)
Thanks
Regards,Fernando
The easiest way would be to add a confirm message to your button click event handler on the client-side. Basically cancel the button-click if !confirm("are you sure you want to delete this row").
Posting back and forth the the server to accomplish this is a bit more complicated. It also causes some unnecesary traffic so it may effect server performance. But if you really must handle this on the server, you can use the before row deleted event on the serverside. Cancel the event so that the grid does not perform the delete. Instead, make a panel visible which asks about the delete and has 2 buttons. You should encode the row id into the commandtext for the button, and then on the button event delete the appropriate row.
-Tony
Any thoughts on how to handle when the server-side deletion attempt fails (all still as grid within webasynch panel)?
I'm thinking of this sequence of events:
1. User presses delete button client-side to delete row - gets prompted to confirm and they say yes. Delete the row client-side to trigger server-side postback.
2. In server-side delete row event handler, attempt to delete row fails.
3. Now back to the client but the row's gone - what do we do?
Basically is there any way to handle this using infragistics technology?
First: thank you very much for your help.
[
]
That is just what I want. But: where is the "button click event handler"? If I use only one button for all the grid, selecting a row before deleting, I can add that confirmation, but in this case the button is a button per row. This is, I change the Column.Type in the Grid.InitializeLayout event, so how can I add a button click event handler to that button (really: many buttons, one per row)?For instance, I have:Protected Sub UltraWebGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles UltraWebGrid1.InitializeLayout
col = Utils.GetGridCol(UltraWebGrid1, "Remove") col.Header.Caption = "Remove" col.Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Button col.AllowUpdate = Infragistics.WebUI.UltraWebGrid.AllowUpdate.Yes
End If
End Sub And I need the event handler to this "button column"
Thanks -Fernando