【问题标题】:How can I add and delete row on Telerik's RadListBox Control?如何在 Telerik 的 RadListBox 控件上添加和删除行?
【发布时间】:2013-03-14 00:44:52
【问题描述】:

我正在使用 Telerik 的 RadListBox 控件进行 Web 应用程序开发,想知道如何通过 TextBox 控件将行添加到 RadListBox,下面是我的代码片段:

<telerik:RadListBox ID="rlbControl" runat="server" SelectionMode="Multiple"> 
   <ItemTemplate> 
      <table>
       <tr>
           <td>
               <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>' ></asp:Label>
           </td>
           <td style="width:20px"></td>
           <td >
               <asp:Label ID="lblAge" runat="server" Text='<%# Eval("Age") %>' ></asp:Label> 
           </td>
       </tr>
     </table>
   </ItemTemplate> 
</telerik:RadListBox> 

Name : <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
Age : <asp:TextBox ID="txtAge" runat="server" ></asp:TextBox>

<asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click"  />
<asp:Button ID="btnDel" runat="server" Text="Delete" OnClick="btnDel_Click"/>

点击添加按钮时,从两个TextBox获取输入并绑定到RadListBox。

要删除,从 RadListBox 中选择行并单击 Delete 按钮,从 RadListBox 中删除选定的行。

我的问题是如何添加和删除行?

先谢谢你了。

【问题讨论】:

    标签: asp.net telerik webforms radlistbox


    【解决方案1】:

    您好,您可以创建数据表和数据行。然后将文本框值添加到 dararow。然后你可以将此数据表绑定到 RadListBox。对于删除,您需要选择 ListItem 索引并从数据表中删除该行,然后再次绑定到 RadListBox。它会工作..

    Link for delete Row demo

    还可以在下面的链接帖子中查看我的答案。您将了解插入行

    Add rows to ListView

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      相关资源
      最近更新 更多