Please explain me how to troubleshoot following issue:
I'm using NeedDataSource event to bind list
protected void RadTreeList2_NeedDataSource(object source, TreeListNeedDataSourceEventArgs e)
{
DataTable dt = GetDataTable();
RadTreeList2.DataSource = dt;
}
In function GetDataTable() two options available:
Option 1 - get data table from execution of database request
DataTable table = objController.GetMessages();
Option 2: Build table 'manually'
DataTable table = new DataTable();
table.Columns.Add("SubjectId", typeof(string));
table.Columns.Add("Subject", typeof(string));
table.Columns.Add("UserName", typeof(string));
table.Columns.Add("Status", typeof(string));
table.Columns.Add("Message", typeof(string));
table.Columns.Add("Date", typeof(DateTime));
table.Columns.Add("Related", typeof(string));
table.Rows.Add("e6628832-54c7-4b18-ad2e-290065bc56c3", "Subject1D", "Sent", "User1", "Body1", DateTime.Now, "");
table.Rows.Add("e6628832-54c7-4b18-ad2e-290065bc56c3", "Subject1D", "Received", "User1", "Body2", DateTime.Now, "e6628832-54c7-4b18-ad2e-290065bc56c3");
table.Rows.Add("e6628832-54ca-4b18-ad2e-290065bc56c3", "Subject2D", "Sent", "User1", "Body3", DateTime.Now, "");
table.Rows.Add("e6628832-54ca-4b18-ad2e-290065bc56c3", "Subject2D", "Received", "User1", "Body4", DateTime.Now, "e6628832-54ca-4b18-ad2e-290065bc56c3");
Both options return the same table (I compared) and show the same information in the list.
The problem is when I using Option 1, collapse/expand is not working either manually (clicking +) not programmatecally. No errors/exception fired.
This is internal RadTreeList - not sure how to find reason for such behavior.
HTML/aspx looks like:
<telerik:RadSkinManager ID="QsfSkinManager" Skin="Default" runat="server" ShowChooser="false" />
<telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
<telerik:RadProgressManager runat="server" ID="RadProgressManager1" /> <div class="demo-containers">
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="0"></telerik:RadAjaxLoadingPanel>
<div class="demo-container">
<h2 class="qsfSubtitle">Messages History</h2>
<telerik:RadAjaxPanel ID="RadAjaxPanel3" LoadingPanelID="RadAjaxLoadingPanel1" runat="server">
<telerik:RadTreeList runat="server" ID="RadTreeList2" AllowPaging="true" PageSize="5" DataKeyNames="SubjectId" ParentDataKeyNames="Related" OnNeedDataSource="RadTreeList2_NeedDataSource"
AutoGenerateColumns="false" OnDeleteCommand="RadTreeList2_DeleteCommand" OnItemCommand="RadTreeList2_ItemCommand"
OnUpdateCommand="RadTreeList2_UpdateCommand" >
<ClientSettings>
<ClientEvents OnItemContextMenu="demo.onItemContextMenu" OnItemDblClick="demo.OnItemDblClick" OnItemClick="demo.OnItemClick"></ClientEvents>
<Selecting AllowItemSelection="True"></Selecting>
</ClientSettings>
<Columns>
<telerik:TreeListBoundColumn DataField="SubjectId" HeaderText="SubjectId" UniqueName="SubjectId">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="5%"/>
<HeaderStyle HorizontalAlign="Left" Width="5%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="Subject" HeaderText="Subject" UniqueName="Subject">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="15%"/>
<HeaderStyle HorizontalAlign="Left" Width="15%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="15%"/>
<HeaderStyle HorizontalAlign="Left" Width="15%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="10%"/>
<HeaderStyle HorizontalAlign="Left" Width="10%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListTemplateColumn HeaderText="Message" SortExpression="Message" UniqueName="Message">
<ItemTemplate>
<asp:Label runat="server" ID="lblStatus" Text='<%# Eval("Message") %>' ToolTip='<%# Eval("Message") %>'/>
</ItemTemplate>
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="40%" Wrap = "False" />
<HeaderStyle HorizontalAlign="Left" Width="40%" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListBoundColumn DataField="Date" HeaderText="Date" UniqueName="Date">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="15%"/>
<HeaderStyle HorizontalAlign="Left" Width="15%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="Related" HeaderText="Related" UniqueName="Related"></telerik:TreeListBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template" PopUpSettings-Width="600px">
<FormTemplate>
<div class="editTemplate">
<table>
<tr class="EditFormHeader">
<td colspan="2" style="font-size: small">
<b>Reply:</b>
</td>
</tr>
<tr>
<td style="vertical-align: top">
<table class="module">
<tr>
<td colspan = "2">
<asp:TextBox ID="txtMsg" TextMode = "MultiLine" Height = "100" Width = "300" Text='<%# Eval("Message", "\n >>>>\n {0} ") %>' runat="server">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
<telerik:RadButton ID= "btnSend" Text = "Send" CommandName = "Update" Icon-PrimaryIconCssClass="rbOk" runat="server"/> </td>
<td>
<telerik:RadButton ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel" Icon-PrimaryIconCssClass="rbCancel" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</FormTemplate>
</EditFormSettings>
</telerik:RadTreeList>
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" RelativeTo="Mouse"
Position="MiddleRight" AutoTooltipify="false" ContentScrolling="Default" Width="50"
Height="10" />
<telerik:RadContextMenu ID="RadContextMenu1" runat="server" OnClientItemClicked="demo.onClientItemClicked">
<Items>
<telerik:RadMenuItem Text="Reply" Value="Edit"></telerik:RadMenuItem>
<telerik:RadMenuItem Text="Delete" Value="Delete"></telerik:RadMenuItem>
</Items>
</telerik:RadContextMenu>
</telerik:RadAjaxPanel>
</div>
</div>
Thanks you,
Boris
I'm using NeedDataSource event to bind list
protected void RadTreeList2_NeedDataSource(object source, TreeListNeedDataSourceEventArgs e)
{
DataTable dt = GetDataTable();
RadTreeList2.DataSource = dt;
}
In function GetDataTable() two options available:
Option 1 - get data table from execution of database request
DataTable table = objController.GetMessages();
Option 2: Build table 'manually'
DataTable table = new DataTable();
table.Columns.Add("SubjectId", typeof(string));
table.Columns.Add("Subject", typeof(string));
table.Columns.Add("UserName", typeof(string));
table.Columns.Add("Status", typeof(string));
table.Columns.Add("Message", typeof(string));
table.Columns.Add("Date", typeof(DateTime));
table.Columns.Add("Related", typeof(string));
table.Rows.Add("e6628832-54c7-4b18-ad2e-290065bc56c3", "Subject1D", "Sent", "User1", "Body1", DateTime.Now, "");
table.Rows.Add("e6628832-54c7-4b18-ad2e-290065bc56c3", "Subject1D", "Received", "User1", "Body2", DateTime.Now, "e6628832-54c7-4b18-ad2e-290065bc56c3");
table.Rows.Add("e6628832-54ca-4b18-ad2e-290065bc56c3", "Subject2D", "Sent", "User1", "Body3", DateTime.Now, "");
table.Rows.Add("e6628832-54ca-4b18-ad2e-290065bc56c3", "Subject2D", "Received", "User1", "Body4", DateTime.Now, "e6628832-54ca-4b18-ad2e-290065bc56c3");
Both options return the same table (I compared) and show the same information in the list.
The problem is when I using Option 1, collapse/expand is not working either manually (clicking +) not programmatecally. No errors/exception fired.
This is internal RadTreeList - not sure how to find reason for such behavior.
HTML/aspx looks like:
<telerik:RadSkinManager ID="QsfSkinManager" Skin="Default" runat="server" ShowChooser="false" />
<telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
<telerik:RadProgressManager runat="server" ID="RadProgressManager1" /> <div class="demo-containers">
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="0"></telerik:RadAjaxLoadingPanel>
<div class="demo-container">
<h2 class="qsfSubtitle">Messages History</h2>
<telerik:RadAjaxPanel ID="RadAjaxPanel3" LoadingPanelID="RadAjaxLoadingPanel1" runat="server">
<telerik:RadTreeList runat="server" ID="RadTreeList2" AllowPaging="true" PageSize="5" DataKeyNames="SubjectId" ParentDataKeyNames="Related" OnNeedDataSource="RadTreeList2_NeedDataSource"
AutoGenerateColumns="false" OnDeleteCommand="RadTreeList2_DeleteCommand" OnItemCommand="RadTreeList2_ItemCommand"
OnUpdateCommand="RadTreeList2_UpdateCommand" >
<ClientSettings>
<ClientEvents OnItemContextMenu="demo.onItemContextMenu" OnItemDblClick="demo.OnItemDblClick" OnItemClick="demo.OnItemClick"></ClientEvents>
<Selecting AllowItemSelection="True"></Selecting>
</ClientSettings>
<Columns>
<telerik:TreeListBoundColumn DataField="SubjectId" HeaderText="SubjectId" UniqueName="SubjectId">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="5%"/>
<HeaderStyle HorizontalAlign="Left" Width="5%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="Subject" HeaderText="Subject" UniqueName="Subject">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="15%"/>
<HeaderStyle HorizontalAlign="Left" Width="15%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="15%"/>
<HeaderStyle HorizontalAlign="Left" Width="15%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="Status" HeaderText="Status" UniqueName="Status">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="10%"/>
<HeaderStyle HorizontalAlign="Left" Width="10%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListTemplateColumn HeaderText="Message" SortExpression="Message" UniqueName="Message">
<ItemTemplate>
<asp:Label runat="server" ID="lblStatus" Text='<%# Eval("Message") %>' ToolTip='<%# Eval("Message") %>'/>
</ItemTemplate>
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="40%" Wrap = "False" />
<HeaderStyle HorizontalAlign="Left" Width="40%" />
</telerik:TreeListTemplateColumn>
<telerik:TreeListBoundColumn DataField="Date" HeaderText="Date" UniqueName="Date">
<ItemStyle VerticalAlign="Middle" HorizontalAlign="Left" Width="15%"/>
<HeaderStyle HorizontalAlign="Left" Width="15%" />
</telerik:TreeListBoundColumn>
<telerik:TreeListBoundColumn DataField="Related" HeaderText="Related" UniqueName="Related"></telerik:TreeListBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template" PopUpSettings-Width="600px">
<FormTemplate>
<div class="editTemplate">
<table>
<tr class="EditFormHeader">
<td colspan="2" style="font-size: small">
<b>Reply:</b>
</td>
</tr>
<tr>
<td style="vertical-align: top">
<table class="module">
<tr>
<td colspan = "2">
<asp:TextBox ID="txtMsg" TextMode = "MultiLine" Height = "100" Width = "300" Text='<%# Eval("Message", "\n >>>>\n {0} ") %>' runat="server">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
<telerik:RadButton ID= "btnSend" Text = "Send" CommandName = "Update" Icon-PrimaryIconCssClass="rbOk" runat="server"/> </td>
<td>
<telerik:RadButton ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel" Icon-PrimaryIconCssClass="rbCancel" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</FormTemplate>
</EditFormSettings>
</telerik:RadTreeList>
<telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" RelativeTo="Mouse"
Position="MiddleRight" AutoTooltipify="false" ContentScrolling="Default" Width="50"
Height="10" />
<telerik:RadContextMenu ID="RadContextMenu1" runat="server" OnClientItemClicked="demo.onClientItemClicked">
<Items>
<telerik:RadMenuItem Text="Reply" Value="Edit"></telerik:RadMenuItem>
<telerik:RadMenuItem Text="Delete" Value="Delete"></telerik:RadMenuItem>
</Items>
</telerik:RadContextMenu>
</telerik:RadAjaxPanel>
</div>
</div>
Thanks you,
Boris