我初学,为什么把按钮列中的按钮换成Button或ImageButton就不能引发,Edit事件了呢?我已经写CommandName=Edit了??
------解决方案--------------------------------------------------------
肯定不行,如果不可以,请贴你的代码
------解决方案--------------------------------------------------------
估计是事件与对应函数脱钩了,看看DataGrid属性窗口中的事件EditCommand\UpdateCommand\DeketeCommand是否指向了正确的函数.
------解决方案--------------------------------------------------------
据我所知,你还是看看你的command,如果是origin版的,经常会这样,555555555,我不得不自己手工写
------解决方案--------------------------------------------------------
可以用 Button的 设置一下 CommandName 就行了 在EditCommand事件里就能捕捉到
if(e.CommandName == "设置的值 ")
{
//..........
}
------解决方案--------------------------------------------------------
关注
------解决方案--------------------------------------------------------
imagebutton你会用就没问题!
------解决方案--------------------------------------------------------
关注..
------解决方案--------------------------------------------------------
这个没有问题,用什么按钮没有任何关系,给你一段示例代码,是使用imagebutton的。
aspx:
<asp:datagrid id= "dgList " runat= "server " Width= "100% " CssClass= "datagrid " AutoGenerateColumns= "False "
CellPadding= "3 " BorderColor= "#003366 " BackColor= "White " AllowSorting= "True ">
<AlternatingItemStyle BackColor= "#EFF5FB "> </AlternatingItemStyle>
<ItemStyle HorizontalAlign= "Left " BackColor= "White "> </ItemStyle>
<HeaderStyle Font-Bold= "True " HorizontalAlign= "Center " ForeColor= "White " BackColor= "#6699CC "> </HeaderStyle>
<Columns>
<asp:BoundColumn Visible= "False " DataField= "ID " HeaderText= "ID "> </asp:BoundColumn>
<asp:BoundColumn DataField= "InputDate " HeaderText= "日期 ">
<HeaderStyle Width= "70px "> </HeaderStyle>
<ItemStyle HorizontalAlign= "Center "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "ShiftDesc " HeaderText= "班次 ">
<HeaderStyle Width= "60px "> </HeaderStyle>
<ItemStyle HorizontalAlign= "Center "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "Auditor " HeaderText= "Auditor ">
<HeaderStyle Width= "60px "> </HeaderStyle>
<ItemStyle HorizontalAlign= "Center "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "FloorDesc " HeaderText= "楼层 ">
<HeaderStyle Width= "20% "> </HeaderStyle>
<ItemStyle HorizontalAlign= "Center "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "LineDesc " HeaderText= "拉号 ">
<HeaderStyle Width= "20% "> </HeaderStyle>
<ItemStyle HorizontalAlign= "Center "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "Series " HeaderText= "系列 ">
<HeaderStyle Width= "25% "> </HeaderStyle>
<ItemStyle HorizontalAlign= "Center "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "Model " HeaderText= "MODEL ">