DataBinding: 'Telerik.Web.UI.TreeListInsertionObject' does not contain a property with the name ""

4 posts, 0 answers
  1. Sayantan
    Sayantan avatar
    5 posts
    Member since:
    Nov 2012

    Posted 21 Dec 2012 Link to this post

    Hi friends,I have Telerik Treelist control which works perfectly when I use EditFormType="AutoGenerated"
    but when I use EditFormType="Template" with a customized template my template for insertion is not showing when I click in the Add(+) image.The template for edit works fine.
    When I use breakpoint in the RadTreeList1_ChildItemsDataBind event I found this error.
    I have a textbox and checkbox in the template.
    The aspcheckbox is creating the problem.I tried with the following solution of using RadTreeList1_ItemCommand()
    System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();
        newValues["AccountName"] = string.empty
        newValues["IsDirect"] = true;

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    but it does'nt work.
    I am posting my code sniplet below:

    <telerik:RadTreeList ID="RadTreeList1" runat="server"
                AutoGenerateColumns="false" DataKeyNames="AccountId"
            AllowLoadOnDemand="True"  EditMode="EditForms"
                onchilditemsdatabind="RadTreeList1_ChildItemsDataBind"
                onneeddatasource="RadTreeList1_NeedDataSource" AllowPaging="True" AllowSorting="True"           
                ParentDataKeyNames="PAccountId" Skin="Web20"
                oninsertcommand="RadTreeList1_InsertCommand"       
                >
    <Columns>
                   <telerik:TreeListEditCommandColumn UniqueName="InsertCommandColumn" ButtonType="ImageButton"
                    HeaderStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                </telerik:TreeListEditCommandColumn>
                   <telerik:TreeListButtonColumn UniqueName="DeleteCommandColumn" Text="Delete" CommandName="Delete"
                    ButtonType="ImageButton" HeaderStyle-Width="20px">
                </telerik:TreeListButtonColumn>
                    <telerik:TreeListBoundColumn DataField="AccountId" HeaderText="ActId" ReadOnly="true"
                        UniqueName="AccountId"  HeaderStyle-Width="30px" ForceExtractValue="Always">                    
                    </telerik:TreeListBoundColumn>
                     <telerik:TreeListBoundColumn DataField="PAccountId" HeaderText="PActId" ReadOnly="true"
                        MaxWidth="" MinWidth="" UniqueName="PAccountId"  HeaderStyle-Width="30px" ForceExtractValue="Always">                    
                    </telerik:TreeListBoundColumn>
                    <telerik:TreeListBoundColumn DataField="AccountName" HeaderText="Account Name"  
                        HeaderStyle-Width="180px" UniqueName="ActName">
                    </telerik:TreeListBoundColumn>
     </Columns>
                
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                    <table class="modalBox" style="width:500px">
                     <tr>
                            <td style="height:10px"></td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                    <td align="left"><asp:Label ID="lblAccountName" runat="server" Text="Account Name" CssClass="Main_LabelText" Width="120px"></asp:Label>
                                    </td>
                                    <td align="left">
                                   <asp:TextBox ID="txtAccountName" runat="server" Text='<%# Eval("AccountName") %>'   CssClass="TextBoxSmall"></asp:TextBox>
                                 </td>
                                    </tr>
                                    <tr>
                                        <td style="height:10px"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
     <tr>
                                        <td>                                  
                                            <asp:CheckBox ID="chkIsDirect" CssClass="chkbxSmall" Width="100px" runat="server" Text="IsDirect" TextAlign="Left" Checked='<%# Bind("IsDirect") %>' />
                                            
                                        </td>
                                    </tr>
                                </table>
     <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td style="height:10px"></td>
                                    </tr>
                                    <tr>
                                    <td>
                                   <telerik:RadButton ID="btnUpdate" Text='<%# (Container is TreeListEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is TreeListEditFormInsertItem) ? "PerformInsert" : "Update" %>'
                                    Icon-PrimaryIconCssClass="rbOk">
                                </telerik:RadButton>
                               
                                </td>
                                    <td> <telerik:RadButton ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                    CommandName="Cancel" Icon-PrimaryIconCssClass="rbCancel">
                                </telerik:RadButton></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        
                        <tr>
                            <td style="height:10px"></td>
                        </tr>
                    </table>
                       
                    </FormTemplate>
                </EditFormSettings>
                
            </telerik:RadTreeList>
  2. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 26 Dec 2012 Link to this post

    Hello Sayantan,

    Please use Bind method instead of Eval for all of the edited fields controls. For practical implementation of your scenario, please refer to this demo:
    http://demos.telerik.com/aspnet-ajax/treelist/examples/dataediting/formtemplateusercontrol/defaultcs.aspx

    I hope this will prove helpful.

    Regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sayantan
    Sayantan avatar
    5 posts
    Member since:
    Nov 2012

    Posted 27 Dec 2012 Link to this post

    Hello Eyup,
    I tried with Bind method also to bind the textbox.But it showed the same error.
    Please tell me how can I use databound asp:CheckBox inside the FormTemplate.


  5. Khurram Nazir
    Khurram Nazir avatar
    2 posts
    Member since:
    Dec 2005

    Posted 21 Oct 2014 in reply to Sayantan Link to this post

    Hello Sayantan,


    In order to bind the controls in FormTemplate, you have to have all those columns in <column> section. If you don't want to show them then you to set the visible property to false, then Bind works.
Back to Top