RadListView InsertItem Null Values

3 posts, 1 answers
  1. K W
    K W avatar
    9 posts
    Member since:
    May 2010

    Posted 06 May 2010 Link to this post

    I have created a RadlistView with the an InsertItemTemplate but when the Insert is carried out the values in the textboxes do not insert into the database. the insert process seems to be working, its just not taking the values from the textboxes.
    The delete and edit templates are working great, its just the insert that doesn't seem to work. Would there be any reason for this?
    Here is the insert code:

    <telerik:RadListView ID="radListView1" DataSourceID="sqlDataSource1" runat="server" 
    ItemPlaceholderID="Container" DataKeyNames="ID" AllowPaging="true" 
    OnItemCommand="RadListView1_ItemCommand">  
    <InsertItemTemplate>  
    <fieldset style="float: left; width: 370px; height: 200px;">  
    <legend>Name:<asp:TextBox ID="txtBoxName" runat="server" /></legend>  
    <table cellpadding="0" cellspacing="0" style="width: 370px;">  
       <tr>  
         <td>  
           <table cellpadding="0" cellspacing="5">  
             <tr>  
               <td style="width: 25%">type:</td>  
               <td style="width: 75%">  
                  <asp:TextBox ID="txtBoxType" runat="server" />  
               </td>  
             </tr>  
             <tr>  
              <td></td>  
              <td>  
                 <asp:TextBox runat="server" ID="txtBoxTitle"></asp:TextBox>  
              </td>  
             </tr>  
           </table>  
          </td>  
          <td align="right" style="width: 25%; padding-left: 10px;"></td>  
        </tr>  
        <tr>  
          <td colspan="2">  
          <div style="float: left; width: 160px;">  
          <asp:Button ID="btnPerformInsert" runat="server" Text="Insert" CommandName="PerformInsert"/>  
         <asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" />  
         </div>  
         </td>  
       </tr>  
       </table>  
       </fieldset>  
    </InsertItemTemplate>  
     <asp:SqlDataSource ID="sqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
    InsertCommand="INSERT INTO Names (name, type, title) VALUES (@name, @type, @title)">  
     
    <InsertParameters>  
                                <asp:Parameter Name="name" Type="String" />  
                                <asp:Parameter Name="type" Type="String" />  
                                <asp:Parameter Name="title" Type="String" />  
                            </InsertParameters> 


  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 10 May 2010 Link to this post

    Hi,

    In order RadListView to be able to extract values from controls placed inside its templates, you should use two-way binding expression through Bind method. Therefore please add the appropriate expression to all controls ("txtBoxType" and "txtBoxTitle" for example) which values should be extracted.

    Greetings,
    Rosen
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. K W
    K W avatar
    9 posts
    Member since:
    May 2010

    Posted 12 May 2010 Link to this post

    Thanks very much. Added in the Bind method and all is working great.
Back to Top