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:
<asp:DataGrid id="DataGrid1"
runat="server"
BorderColor="Tan"
BorderWidth="1px"
BackColor="LightGoldenrodYellow"
CellPadding="2"
GridLines="None"
ForeColor="Black"
onEditCommand ="Edit_command"
onUpadteCommand="Update_command"
onCancelCommand="Cancel_command">
<Columns>
<asp:EditCommandColumn
ButtonType="LinkButton"
UpdateText="Update"
CancelText="Cancel"
EditText="Edit"></asp:EditCommandColumn>
</Columns>
in my aspx.vb file i have this procedure
VB Code:
Public Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
datagrid1.edititemindex = e.item.itemindex
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...
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:
onEditCommand ="[COLOR=Red]DataGrid1_editcommand[/COLOR]"
aspx.vb
VB Code:
Public Sub [COLOR=Red]DataGrid1_editcommand[/COLOR](ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
DataGrid1.EditItemIndex = CInt(e.Item.ItemIndex)
End Sub