D
Darren Wooding
Hello, can anyone offer any advice, this one is driving me
up the wall!
1. I am using a webform datagrid.
2. The columns are all dynamic and defined using templates
(see code below).
3. I have a nice set of buttons on the grid for edit,
update, cancel and delete.
4. I handle the events with the "Handles
dgGrid.EditCommand", "Handles dgGrid.UpdateCommand",
and "Handles dgGrid.CancelCommand" options (again see the
code below).
The problem is that edit and delete work perfectly but I
can not get the cancel and update commands to fire. All
they do is cause a postback. Any suggestions?
Code from webform1.aspx (headers only)
--------------------------------------------------------
Sub dgGrid_Edit(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.EditCommand
Sub dgGrid_Cancel(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.CancelCommand
Sub dgGrid_Delete(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.DeleteCommand
Sub dgGrid_Update(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.UpdateCommand
Code from templates
-------------------------------------------------------
Case ListItemType.Item
Dim ctl As New LinkButton
ctl.ID = "lnkbutEdit"
ctl.Width = Unit.Pixel(16)
ctl.Text = "<img border=0
src=images/im_edit.gif alt=edit>"
ctl.CommandName = "Edit"
ctl.CausesValidation = False
container.Controls.Add(ctl)
Case ListItemType.EditItem
'Save
Dim ctl1 As New LinkButton
ctl1.ID = "lnkbutUpdate"
ctl1.Width = Unit.Pixel(16)
ctl1.Text = "<img border=0
src=images/im_update.gif alt=update>"
ctl1.CommandName = "Update"
ctl1.CausesValidation = True
container.Controls.Add(ctl1)
up the wall!
1. I am using a webform datagrid.
2. The columns are all dynamic and defined using templates
(see code below).
3. I have a nice set of buttons on the grid for edit,
update, cancel and delete.
4. I handle the events with the "Handles
dgGrid.EditCommand", "Handles dgGrid.UpdateCommand",
and "Handles dgGrid.CancelCommand" options (again see the
code below).
The problem is that edit and delete work perfectly but I
can not get the cancel and update commands to fire. All
they do is cause a postback. Any suggestions?
Code from webform1.aspx (headers only)
--------------------------------------------------------
Sub dgGrid_Edit(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.EditCommand
Sub dgGrid_Cancel(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.CancelCommand
Sub dgGrid_Delete(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.DeleteCommand
Sub dgGrid_Update(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles dgGrid.UpdateCommand
Code from templates
-------------------------------------------------------
Case ListItemType.Item
Dim ctl As New LinkButton
ctl.ID = "lnkbutEdit"
ctl.Width = Unit.Pixel(16)
ctl.Text = "<img border=0
src=images/im_edit.gif alt=edit>"
ctl.CommandName = "Edit"
ctl.CausesValidation = False
container.Controls.Add(ctl)
Case ListItemType.EditItem
'Save
Dim ctl1 As New LinkButton
ctl1.ID = "lnkbutUpdate"
ctl1.Width = Unit.Pixel(16)
ctl1.Text = "<img border=0
src=images/im_update.gif alt=update>"
ctl1.CommandName = "Update"
ctl1.CausesValidation = True
container.Controls.Add(ctl1)