[求助]DataGrid编辑命令列不能编辑,为什么???
如题,以下是代码:html:
<table width="70%" align="center">
<tr>
<td>
<asp:datagrid id="datagridBak" HorizontalAlign="Center" Runat="server" AllowCustomPaging="True"
AllowPaging="True" AllowSorting="True" PagerStyle-Mode="NumericPages" PagerStyle-HorizontalAlign="Right"
PagerStyle-NextPageText="下一页" PagerStyle-PrevPageText="上一页" BorderColor="Gray" BorderWidth="1px"
CellPadding="3" Font-Size="Smaller" HeaderStyle-BackColor="#88bce9" Width="100%" AutoGenerateColumns="False"
OnUpdateCommand="datagridBak_Update" OnCancelCommand="datagridBak_Cancel" OnEditCommand="datagridBak_Edit">
<ItemStyle Font-Size="X-Small" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
<HeaderStyle Font-Size="X-Small" Font-Names="宋体" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle"
BackColor="#88BCE9"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="jsid" HeaderText="角色id">
<HeaderStyle Height="25px" Width="10%"></HeaderStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="jsmc" HeaderText="角色名称"></asp:BoundColumn>
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="更新" HeaderText="编辑" CancelText="取消" EditText="修改">
</asp:EditCommandColumn>
</Columns>
<PagerStyle VerticalAlign="Middle" NextPageText="下一页" Font-Size="XX-Small" Font-Underline="True"
Font-Bold="True" PrevPageText="上一页" HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
</td>
</tr>
</table>
.cs:
。。。。。。
public void datagridBak_Edit(object sender,DataGridCommandEventArgs e)
{
Response.Write("<script>alert('aaaa')</script>");
datagridBak.EditItemIndex=e.Item.ItemIndex;
datagridBak.DataBind();
}
public void datagridBak_Cancel(object sender,DataGridCommandEventArgs e)
{
Response.Write("<script>alert('bbbb')</script>");
datagridBak.EditItemIndex=-1;
datagridBak.DataBind();
}
public void datagridBak_Update(object sender,DataGridCommandEventArgs e)
{
Response.Write("<script>alert('cccc')</script>");
datagridBak.DataBind();
}
为什么我点“修改”,boundcolumn不能变成编辑模式呢??连response.write都不跳出来??请前辈指点,谢谢