webform datagrid: "Handles dgGrid.UpdateCommand"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Darren Wooding

    #1

    webform datagrid: "Handles dgGrid.UpdateCommand"

    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.EditComm and", "Handles dgGrid.UpdateCo mmand",
    and "Handles dgGrid.CancelCo mmand" 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(ByV al sender As Object, ByVal e As
    DataGridCommand EventArgs) Handles dgGrid.EditComm and

    Sub dgGrid_Cancel(B yVal sender As Object, ByVal e As
    DataGridCommand EventArgs) Handles dgGrid.CancelCo mmand

    Sub dgGrid_Delete(B yVal sender As Object, ByVal e As
    DataGridCommand EventArgs) Handles dgGrid.DeleteCo mmand

    Sub dgGrid_Update(B yVal sender As Object, ByVal e As
    DataGridCommand EventArgs) Handles dgGrid.UpdateCo mmand



    Code from templates
    -------------------------------------------------------
    Case ListItemType.It em
    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.CausesValid ation = False
    container.Contr ols.Add(ctl)
    Case ListItemType.Ed itItem
    'Save
    Dim ctl1 As New LinkButton
    ctl1.ID = "lnkbutUpda te"
    ctl1.Width = Unit.Pixel(16)
    ctl1.Text = "<img border=0
    src=images/im_update.gif alt=update>"
    ctl1.CommandNam e = "Update"
    ctl1.CausesVali dation = True
    container.Contr ols.Add(ctl1)

  • Darren Wooding

    #2
    webform datagrid: &quot;Handle s dgGrid.UpdateCo mmand&quot;

    [color=blue]
    >-----Original Message-----
    >Hello, can anyone offer any advice, this one is driving[/color]
    me[color=blue]
    >up the wall!
    >
    >1. I am using a webform datagrid.
    >2. The columns are all dynamic and defined using[/color]
    templates[color=blue]
    >(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.EditCom mand", "Handles dgGrid.UpdateCo mmand",
    >and "Handles dgGrid.CancelCo mmand" 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(ByV al sender As Object, ByVal e As
    >DataGridComman dEventArgs) Handles dgGrid.EditComm and
    >
    >Sub dgGrid_Cancel(B yVal sender As Object, ByVal e As
    >DataGridComman dEventArgs) Handles dgGrid.CancelCo mmand
    >
    >Sub dgGrid_Delete(B yVal sender As Object, ByVal e As
    >DataGridComman dEventArgs) Handles dgGrid.DeleteCo mmand
    >
    >Sub dgGrid_Update(B yVal sender As Object, ByVal e As
    >DataGridComman dEventArgs) Handles dgGrid.UpdateCo mmand
    >
    >
    >
    >Code from templates
    >-------------------------------------------------------
    > Case ListItemType.It em
    > 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.CausesValid ation = False
    > container.Contr ols.Add(ctl)
    > Case ListItemType.Ed itItem
    > 'Save
    > Dim ctl1 As New LinkButton
    > ctl1.ID = "lnkbutUpda te"
    > ctl1.Width = Unit.Pixel(16)
    > ctl1.Text = "<img border=0
    >src=images/im_update.gif alt=update>"
    > ctl1.CommandNam e = "Update"
    > ctl1.CausesVali dation = True
    > container.Contr ols.Add(ctl1)
    >
    >.
    >[/color]



    Found the answer here totally by chance.


    8&selm=fee49a9f .0311041652.301 8f54f%40posting .google.com

    Thanks Giorgio!

    Happy New Year everyone.


    Comment

    Working...