如题:
我的源代码如下:
<asp:DataList ID="TuSeeDlt" runat="server" Style="width: 90%" BorderStyle="none" BorderWidth="1px" CellPadding="3" GridLines="horizontal" OnEditCommand="TuSeeDlt_EditCommand">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<ItemTemplate>
<table style="width: 100%;" cellspacing="0">
<tr style="width: 100%;">
<td style="vertical-align: middle; height: 26px; text-align: right;" colspan="5">
<asp:LinkButton ID="Delect" runat="server" CausesValidation="false"
CommandArgument=' <%# DataBinder.Eval(Container.DataItem, "tutor_ID")%>'
CommandName="Delect">删除 </asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
<AlternatingItemStyle BackColor="#F7F7F7" />
<ItemStyle BackColor="White" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
</asp:DataList> protected void TuSeeDlt_EditCommand(object source, DataListCommandEventArgs e)
{
}
单击"删除"为什么不能激发TuSeeDlt_EditCommand事件
我的源代码如下:
<asp:DataList ID="TuSeeDlt" runat="server" Style="width: 90%" BorderStyle="none" BorderWidth="1px" CellPadding="3" GridLines="horizontal" OnEditCommand="TuSeeDlt_EditCommand">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<ItemTemplate>
<table style="width: 100%;" cellspacing="0">
<tr style="width: 100%;">
<td style="vertical-align: middle; height: 26px; text-align: right;" colspan="5">
<asp:LinkButton ID="Delect" runat="server" CausesValidation="false"
CommandArgument=' <%# DataBinder.Eval(Container.DataItem, "tutor_ID")%>'
CommandName="Delect">删除 </asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
<AlternatingItemStyle BackColor="#F7F7F7" />
<ItemStyle BackColor="White" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
</asp:DataList> protected void TuSeeDlt_EditCommand(object source, DataListCommandEventArgs e)
{
}
单击"删除"为什么不能激发TuSeeDlt_EditCommand事件
解决方案 »
- 虚拟主机 ASP.NET 2.0 Membership/Role Provider怎么配置SQL Server 2000,有经验的进!
- margin: 0px 0px 0px 0px
- 解析存储过程,高手帮忙!!
- 我用vs2008生成随机数,怎么做
- 我在用freebox时为什么时常出现这种错位提示???我改怎么修改
- DataGrid取列名问题
- 关于asp.net操作Excel的问题
- asp.net 2.0主表中lookup字段的输入问题
- repeater里,怎么得不到记录的id,谢大家帮忙看看,谢谢了~~
- 帮忙看一下吧!我真急坏了!
- [求助]Image读取数据库中以路径形式存储的图片
- 在DataList中,单击LinkButton,为什么不能激发EditCommand事件
<asp:LinkButton ID="Delect" runat="server" CausesValidation="false"
CommandArgument=' <%# DataBinder.Eval(Container.DataItem, "tutor_ID")%>'
CommandName="Delect">删除 </asp:LinkButton>
改为:
<asp:LinkButton ID="Delect" runat="server" CausesValidation="false"
CommandArgument=' <%# DataBinder.Eval(Container.DataItem, "tutor_ID")%>'
CommandName="Edit">删除 </asp:LinkButton> 如果要激发这个事件(以你的理解是不是这一行为编辑状态?)
你要在
public void TuSeeDlt_EditCommand(object 参数, e参数)
{
e.item.itemindex=-1;
}另外如果你想要更新DATALIST里面的内容的话
再在DATALIST中建立一个EDITITEMPLE编辑模板才行
他的CommandName是UPDATE才行
代码在public void TuSeeDlt_UpdateCommand(object 参数, e参数)里面编写
====>
如果是删除的话: CommandName="Delete"
如果是编辑的话: CommandName="Edit"
如果是取消的放: CommandName="Cancel"