Hello,
I would like to have in my gridView a delete button(no commandButton) for each row added.
When i clicked on one of this buttons, i would like the corresponding row to be deleted.
This is what it does:
ICreate the button on cellFormatting and add an eventHandler
Now, i would like the row to be deleted when the delete button is clicked, but i don't know how.
I tried this, but it doesn't delete the right row
.
can you help me?
Thank you
==: Shirya :==
I would like to have in my gridView a delete button(no commandButton) for each row added.
When i clicked on one of this buttons, i would like the corresponding row to be deleted.
This is what it does:
ICreate the button on cellFormatting and add an eventHandler
| Private Sub GridViewPrepack_CellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles GridViewPrepack.CellFormatting | ||
| |
||
| If Not (e.CellElement.Children.Count > 0) Then | ||
| Dim myButton As New RadButtonElement | ||
| 'Display style of the Image | ||
| if CType(e.CellElement.ColumnInfo,GridViewDataColumn).FieldName = "Delete" | ||
| AddHandler myButton.Click, AddressOf DeleteButton_Click | ||
| 'add the button to the cell | ||
| e.CellElement.Children.Add(myButton) | ||
| End If | ||
| End If | ||
| End Sub |
Now, i would like the row to be deleted when the delete button is clicked, but i don't know how.
I tried this, but it doesn't delete the right row
| Private Sub DeleteButton_Click(ByVal sender As Object, ByVal e As EventArgs) |
| GridViewPrepack.Rows.Remove(GridViewPrepack.CurrentRow) |
| End Sub |
can you help me?
Thank you
==: Shirya :==