添加行从客户端具有的ItemTemplate Radlistbox

问题描述:

如何添加一行到radlistbox上点击从客户端(JavaScript)为我radlistbox添加按钮还包含项目模板添加行从客户端具有的ItemTemplate 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" /> 

你可以用ItemTemplate中做到这一点因为ItemTemplates是基于服务器的。

您需要使用ClientTemplate。顾名思义,这是您在客户端提供的模板。

看看这个演示。

http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/clienttemplates/defaultcs.aspx

这应该帮助你。