新手求助,为什么绑定数据后无法编辑……
为什么我一点编辑,就出现javascript错误,提示对象不支持此方法或属性。
前台:
<asp:DataGrid ID= "MyDataGrid " runat= "server " Width= "700 " BackColor= "#ECDCF2 " BorderColor= "Black "
ShowFooter= "false " CellPadding= "3 " CellSpacing= "0 " Font-Names= "宋体 " Font-Size= "10pt "
HeaderStyle-BackColor= "#C59FD2 " OnEditCommand= "MyDataGrid_Edit "
OnCancelCommand= "MyDataGrid_Cancel " OnUpdateCommand= "MyDataGrid_Update " DataKeyField= "emp_no ">
<Columns>
<asp:EditCommandColumn EditText= "编辑 " CancelText= "取消 " UpdateText= "更新 " ItemStyle-Wrap= "false "> </asp:EditCommandColumn>
</Columns>
</asp:DataGrid>
后台:
public void MyDataGrid_Edit(Object sender, DataGridCommandEventArgs e)
{
MyDataGrid.EditItemIndex = (int)e.Item.ItemIndex;
bind();
}