點擊GridView中的編輯,為什麽不會執行編輯事件
<asp:GridView ID= "gvMaterialList " runat= "server " AutoGenerateColumns= "False " BackColor= "White "
BorderColor= "#E7E7FF " BorderStyle= "None " BorderWidth= "1px " CellPadding= "3 " Width= "100% "
CssClass= "GridView " OnRowUpdating= "gvMaterialList_RowUpdating " OnRowCancelingEdit= "gvMaterialList_RowCancelingEdit " OnRowEditing= "gvMaterialList_RowEditing ">
<HeaderStyle CssClass= "gvHeader " />
<RowStyle CssClass= "gvItem " />
<AlternatingRowStyle CssClass= "gvAlterStyle " />
<Columns>
<asp:BoundField DataField= "MaterialNumber " ReadOnly= "True " HeaderText= "物料編號 "/>
<asp:HyperLinkField DataNavigateUrlFields= "MaterialNumber " DataNavigateUrlFormatString= "MaterialView.aspx?MaterialNumber={0} "
DataTextField= "MaterialName " HeaderText= "物料名稱 " />
<asp:BoundField DataField= "Brand " ReadOnly= "True " HeaderText= "品牌 " />
<asp:BoundField DataField= "Specification " ReadOnly= "True " HeaderText= "型號 " />
<asp:BoundField DataField= "Quantity " ReadOnly= "True " HeaderText= "數量 " />
<asp:BoundField DataField= "Unit " ReadOnly= "True " HeaderText= "單位 " />
<asp:BoundField DataField= "Price " ReadOnly= "True " HeaderText= "最新單價 " />
<asp:BoundField DataField= "PriceBudget " HeaderText= "工程師預算單價 " />
<asp:BoundField DataField= "TotalPrice " ReadOnly= "True " HeaderText= "工程師預算縂價 " />
<asp:BoundField DataField= "BUBCPriceBudget " HeaderText= "BU經管預算單價 " />
<asp:BoundField DataField= "BUBCTotalPrice " ReadOnly= "True " HeaderText= "BU經管預算縂價 " />
<asp:BoundField DataField= "FIHBCPriceBudget " HeaderText= "FIH經管預算單價 " />
<asp:BoundField DataField= "FIHBCTotalPrice " ReadOnly= "True " HeaderText= "FIH經管預算縂價 " />
<asp:TemplateField HeaderText= "修改單價 ">
<ItemStyle HorizontalAlign= "Center " />
<EditItemTemplate>
<asp:ImageButton ID= "ImageButton1 " runat= "server " CausesValidation= "True " CommandName= "Update "
Text= "Update " ImageUrl= "~/Images/Toolbar/save_t.gif " /> <asp:ImageButton ID= "ImageButton2 " runat= "server " CausesValidation= "False "
CommandName= "Cancel " ImageUrl= "~/Images/Toolbar/cancel_t.gif " Text= "Cancel " />
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton ID= "ibnEdit " AlternateText= "修改 " CommandName= "Edit " ImageUrl= "../images/Toolbar/Edit_t.gif "
runat= "server " />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
以上為GridView代碼;
protected void gvMaterialList_RowEditing(object sender, GridViewEditEventArgs e)
{
this.gvMaterialList.EditIndex = e.NewEditIndex;
GetMaterialList();
}
以上為Edit事件代碼
[解决办法]
gvMaterialList_RowEditing这个事件有没有绑定GridView中啊,我以前就碰到过~~~
[解决办法]
<asp:ImageButton ID= "ImageButton1 " runat= "server " CausesValidation= "True " CommandName= "Update "
把CommandName= "Update "改成CommandName= "Edit "