ReorderList的Edit如何使用

项目中使用到了Asp.net Ajax4.0中的一个控件——RecordList。

模板中有EditTemplate,但是例子中仅有一个添加模板AddTemplae,网上查了半天也没查到。只好自己在模板里找了一下,现在写出来,方便有同样问题的人。


这个触发编辑的按钮放在ItemTemplate中

   <ItemTemplate>
      <div class="itemArea">
        <asp:Label ID="Label1" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Title"))) %>' />
        <asp:Label ID="Label2" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Description", " - {0}"))) %>' />
        <asp:Button ID="Button1" runat="server" CommandName="Edit" Text="Edit" />
       </div>
    </ItemTemplate>

那个lable1和label2就不要管了,就是一个绑定,重要的是那个button,这样,点击button时就能触发编辑事件了。


样子就是这个样子,点击Edit时,就触发了编辑事件,编辑模式下展示的样子,就是在编辑模板下修改 EditTemplate下修改

    <EditItemTemplate>
        <div class="itemArea">
          <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Title") %>' ValidationGroup="edit" />
          <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Description") %>' ValidationGroup="edit" />
          <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Priority") %>' ValidationGroup="edit" />
          <asp:Button ID="btn_update" runat="server" Text="update" CommandName="Update" />
          <asp:Button ID="btn_cancle" runat="server" Text="cancel" CommandName="Cancel" />
        </div>
   </EditItemTemplate>



这样就实现了编辑的功能。


剩下的功能,就都可以在网上查到了。

俺举一反三的能力太弱,应该不适合当程序员……


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值