This is a migrated thread and some comments may be shown as answers.

RadListView InsertItem Null Values

2 Answers 109 Views
ListView
This is a migrated thread and some comments may be shown as answers.
K W
Top achievements
Rank 1
K W asked on 06 May 2010, 10:03 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 10 May 2010, 08:20 AM
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.
0
K W
Top achievements
Rank 1
answered on 12 May 2010, 10:59 AM
Thanks very much. Added in the Bind method and all is working great.
Tags
ListView
Asked by
K W
Top achievements
Rank 1
Answers by
Rosen
Telerik team
K W
Top achievements
Rank 1
Share this question
or