DataList中CommandName
我点击DataList中三个CommandName分别为edit、delete、update的LinkButton按钮
它触发吃的函数类型是
protected void Edit_But_Click1(object sender, EventArgs e)
{
}
protected void Del_But_Click(object sender, EventArgs e)
{
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
}
为什么触发的不是 protected void LBtnUpdate_Click(object sender, DataListCommandEventArgs e)?我那里做错了?我是新手来的,不是很懂,求各位高手指点指点
我的datalist代码
<asp:DataList id="DataList1" runat="server" CellPadding="2"
ForeColor="#333333" style="margin-left: 12px"
OnItemCommand="DataList1_ItemCommand"
OnEditCommand="DataList1_EditCommand"
OnDeleteCommand="DataList1_DeleteCommand"
OnUpdateCommand="DataList1_UpdateCommand"
>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#EFF3FB" />
<ItemTemplate>
<table cellspacing="0" cellpadding="0" width="600px" border="1">
<tr>
<td align="center"><br>
<table cellpadding="0" cellspacing="0" border="0" width="470">
<tr>
<td style=" text-align:center; width:51%; height:20px; text-align:left">姓名:<%# DataBinder.Eval(Container.DataItem, "addrName")%></td>
<td style=" text-align:center; width:77%; height:20px; text-align:left">关系:<%# DataBinder.Eval(Container.DataItem, "addrRelation")%></td>
</tr>
<tr>
<td style=" width:51%; height:20px; text-align:center">
<asp:LinkButton CommandName="edit" ID="Edit_But" ForeColor="#003366" runat="server" onclick="Edit_But_Click1" Text="编辑"></asp:LinkButton>
</td>
<td style=" width:50%; height:20px; text-align:left">
<asp:LinkButton ID="Del_But" ForeColor="#003366" CommandName="delete" runat="server" onclick="Del_But_Click">删除</asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
<AlternatingItemStyle BackColor="White" />
<EditItemTemplate>
<table cellspacing="0" cellpadding="0" width="900" align="center" border="1">
<tr>
<td align="center"><br>
<table cellpadding="0" cellspacing="0" border="0" width="900">
<tr>
<td style=" width:33%">姓名: