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>
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>