前台:
<table cellpadding="0" cellspacing="0" class="ipt">
<tbody>
<tr>
<th style="width:160px;">種別名</th>
<th style="width:105px;">編集</th>
</tr>
<tr id="trKayiSenSyuBetuAddRow" runat ="server">
<td style="width:160px;">
<cc1:ExTextBox ID="TxtKayiSenSyuBetu" runat="server" MaxLength="20" size="24" ImeMode= "On" Text=""/>
</td>
<td class="c" style="width:105px;">
<cc1:ExButton ID="BtnKayiSenSyuBetuAdd" runat="server" Text="追加" CssClass="button aqua small" OnClientClick="return LvListCheck(1,-1);" OnClick="BtnKayiSenSyuBetuAdd_Click"/>
</td>
</tr>
<asp:ListView ID="LvKayiSenSyuBetu" runat="server" OnItemEditing="LvKayiSenSyuBetu_ItemEditing"
onitemdeleting="LvKayiSenSyuBetu_ItemDeleting" OnItemUpdating="LvKayiSenSyuBetu_ItemUpdating" OnItemCanceling="LvKayiSenSyuBetu_ItemCanceling">
<LayoutTemplate>
<tr id="ItemPlaceHolder" runat="server"></tr>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td style="width:160px"><%# HttpUtility.HtmlEncode(Eval("SYUBETU_NAME").ToString())%></td>
<td class="c" style="width:105px;">
<cc1:ExButton ID="BtnKayiSenSyuBetuEdit" runat="server" Text="編集" CssClass="button orange small" CommandName="Edit" />
<cc1:ExButton ID="BtnKayiSenSyuBetuDel" runat="server" Text="削除" CssClass="button rosy small" CommandName="Delete" />
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr>
<td style="width:160px;">
<cc1:ExTextBox ID="TxtKayiSenSyuBetuLv" runat="server" MaxLength="20" size="24" ImeMode= "On" Text='<%# Eval("SYUBETU_NAME") %>'/>
</td>
<td class="c" style="width:105px;">
<cc1:ExButton ID="BtnKayiSenSyuBetuUpd" runat="server" Text="更新" CssClass="button orange small" CommandName="Update" OnClientClick='<%# "return LvListCheck(1," + Container.DataItemIndex + ");" %>' />
<cc1:ExButton ID="BtnKayiSenSyuBetuCancel" runat="server" Text="取消" CssClass="button rosy small" CommandName="Cancel" />
</td>
</tr>
</EditItemTemplate>
</asp:ListView>
</tbody>
</table>
后台:
①绑定
LvKayiSenSyuBetu.DataSource = dt;
LvKayiSenSyuBetu.DataBind();
②事件
protected void BtnKayiSenSyuBetuAdd_Click(object sender, EventArgs e)
protected void LvKayiSenSyuBetu_ItemEditing(object sender, ListViewEditEventArgs e)
protected void LvKayiSenSyuBetu_ItemDeleting(object sender, ListViewDeleteEventArgs e)
protected void LvKayiSenSyuBetu_ItemUpdating(object sender, ListViewUpdateEventArgs e)
protected void LvKayiSenSyuBetu_ItemCanceling(object sender, ListViewCancelEventArgs e)