Results 1 to 2 of 2

Thread: datagrid onEditcommand explanation

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    134

    datagrid onEditcommand explanation

    hi i am using vb.net, asp.net
    i have a datagrid and i have a this code in my aspx file
    VB Code:
    1. <asp:DataGrid id="DataGrid1"
    2.             runat="server"  
    3.             BorderColor="Tan"
    4.             BorderWidth="1px"
    5.             BackColor="LightGoldenrodYellow"
    6.             CellPadding="2"
    7.             GridLines="None"
    8.             ForeColor="Black"
    9.             onEditCommand ="Edit_command"
    10.                                       onUpadteCommand="Update_command"
    11.                                       onCancelCommand="Cancel_command">
    12.  
    13. <Columns>
    14. <asp:EditCommandColumn
    15. ButtonType="LinkButton"
    16. UpdateText="Update"
    17. CancelText="Cancel"
    18. EditText="Edit"></asp:EditCommandColumn>
    19. </Columns>

    in my aspx.vb file i have this procedure
    VB Code:
    1. Public Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
    2. datagrid1.edititemindex = e.item.itemindex
    3.     End Sub

    i keep on getting this error message that onEditCommand ="Edit_command" is not a member of datagrid 1.. can someone please explain this to me.. thanks in advance...

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Dec 2004
    Posts
    134

    Re: datagrid onEditcommand explanation[Resolved]

    hi just a short note to state i finally resolved the problem.... i had to add the same procedure name with the onEditCommand argument in my aspx file to my aspx.vb file ...

    example for anyone to know
    aspx file
    VB Code:
    1. onEditCommand ="[COLOR=Red]DataGrid1_editcommand[/COLOR]"
    aspx.vb
    VB Code:
    1. Public Sub [COLOR=Red]DataGrid1_editcommand[/COLOR](ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
    2.         DataGrid1.EditItemIndex = CInt(e.Item.ItemIndex)
    3.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width