I am currently evaluating the Telerik suite of tools and trying to write a sample program to provide my management with justification for the purchase of the suite. In doing so I am trying to use the Ajax based suite of products for the first time.
Currently I have a master page with three content panels.
My Tree View is defined with:
------------------------------------------
<telerik:RadTreeView runat="Server" ID="HDQueuesTreeView" OnNodeClick="HDQueuesTreeView_NodeClick"
EnableViewState="False" DataFieldID="NODE_ID" OnClientNodeClicked="onNodeClicking_HDQueuesTreeView"
DataTextField="DISPLAY_TEXT" DataFieldParentID="PARENT_NODE"
OnNodeDataBound="HDQueuesTreeView_NodeDataBound"
DataValueField="OBJECT_AS_XML" >
<DataBindings>
<telerik:RadTreeNodeBinding ToolTipField="TOOL_TIP_TEXT" TextField="DISPLAY_TEXT" ValueField="OBJECT_AS_XML" />
</DataBindings>
</telerik:RadTreeView>
------------------------------------------
My Grid is defined in another content panel with:
------------------------------------------
<telerik:RadGrid ID="HDQueueGrid" runat="server" AutoGenerateColumns="False"
Height="100%" BorderWidth="0px" AllowSorting="True" Style="outline: none" ShowGroupPanel="True"
GridLines="None"
onneeddatasource="HDQueueGrid_NeedDataSource">
<MasterTableView>
<CommandItemSettings ExportToPdfText="Export to Pdf" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
(I snipped out all the columns)
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" AllowDragToGroup="True">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
------------------------------------------
The tree view control populates and the click events fire the required Ajax request to the server. The server side onnodebound events fire. The server side OnClick events never fire. The server side Ajax manager request does fire and it seems to work. My current Ajax event is as follows:
------------------------------------------
protected void MyQueuesAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
//Use the Deserialize method to create a RadTreeNode object from the JSON string representing the node
RadTreeNode clickedNode = new JavaScriptSerializer().Deserialize<RadTreeNode>(e.Argument);
if (clickedNode != null)
{
if (u != null)
{
QB_LAST_CLICKED = XMLSerial.DeserializeObject<QUEUE_BUTTONS>(u, clickedNode.Value);
if (QB_LAST_CLICKED != null)
{
this.Session["LAST_CLICKED_QUEUE"] = QB_LAST_CLICKED;
HDQueueGrid.Rebind();
}
}
}
}
------------------------------------------
My Grids "NeedsDataSource" event is as follows:
------------------------------------------
protected void HDQueueGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
List<QUEUE_CONTENTS> QC_LIST = null;
if ((u != null) &&
(this.IsPostBack == true))
{
if ((QB_LAST_CLICKED != null) &&
(e.IsFromDetailTable == false))
{
QC_LIST = QUEUE_CONTENTS.READDB(u, QB_LAST_CLICKED);
}
}
HDQueueGrid.DataSource = QC_LIST;
}
------------------------------------------
I have confirmed that the datasource does in fact get populated. I just cannot seem to visually show the data. The display content area which "hosts" the grid control is blank.
In case you wish to see my Ajax Manager code:
<telerik:RadAjaxManager runat="server" ID="MyQueuesAjaxManager"
OnAjaxRequest="MyQueuesAjaxManager_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="HDQueuesTreeView">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="HDQueueGrid"
LoadingPanelID="HDAjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
I do not know if it is relevant but this snipped of code is located in the content panel with the TreeView control.
So what am I doing incorrectly? I would revert the project to using a data source on the grid except that I cannot seem to derive the selectedvalue from the treeview control. Those values are always an empty string. (The treeview control is bound to a List<QUEUE_BUTTON> objects)
The treeview is populated using in the page load event using:
if (u != null)
{
if (this.IsPostBack == false)
{
HDQueuesTreeView.DataSource = QUEUE_BUTTONS.READDB(u);
HDQueuesTreeView.DataBind();
}
}
------------------------------------------
Thank you for any pointers you can send my way.
Currently I have a master page with three content panels.
My Tree View is defined with:
------------------------------------------
<telerik:RadTreeView runat="Server" ID="HDQueuesTreeView" OnNodeClick="HDQueuesTreeView_NodeClick"
EnableViewState="False" DataFieldID="NODE_ID" OnClientNodeClicked="onNodeClicking_HDQueuesTreeView"
DataTextField="DISPLAY_TEXT" DataFieldParentID="PARENT_NODE"
OnNodeDataBound="HDQueuesTreeView_NodeDataBound"
DataValueField="OBJECT_AS_XML" >
<DataBindings>
<telerik:RadTreeNodeBinding ToolTipField="TOOL_TIP_TEXT" TextField="DISPLAY_TEXT" ValueField="OBJECT_AS_XML" />
</DataBindings>
</telerik:RadTreeView>
------------------------------------------
My Grid is defined in another content panel with:
------------------------------------------
<telerik:RadGrid ID="HDQueueGrid" runat="server" AutoGenerateColumns="False"
Height="100%" BorderWidth="0px" AllowSorting="True" Style="outline: none" ShowGroupPanel="True"
GridLines="None"
onneeddatasource="HDQueueGrid_NeedDataSource">
<MasterTableView>
<CommandItemSettings ExportToPdfText="Export to Pdf" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
(I snipped out all the columns)
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" AllowDragToGroup="True">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
------------------------------------------
The tree view control populates and the click events fire the required Ajax request to the server. The server side onnodebound events fire. The server side OnClick events never fire. The server side Ajax manager request does fire and it seems to work. My current Ajax event is as follows:
------------------------------------------
protected void MyQueuesAjaxManager_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
//Use the Deserialize method to create a RadTreeNode object from the JSON string representing the node
RadTreeNode clickedNode = new JavaScriptSerializer().Deserialize<RadTreeNode>(e.Argument);
if (clickedNode != null)
{
if (u != null)
{
QB_LAST_CLICKED = XMLSerial.DeserializeObject<QUEUE_BUTTONS>(u, clickedNode.Value);
if (QB_LAST_CLICKED != null)
{
this.Session["LAST_CLICKED_QUEUE"] = QB_LAST_CLICKED;
HDQueueGrid.Rebind();
}
}
}
}
------------------------------------------
My Grids "NeedsDataSource" event is as follows:
------------------------------------------
protected void HDQueueGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
List<QUEUE_CONTENTS> QC_LIST = null;
if ((u != null) &&
(this.IsPostBack == true))
{
if ((QB_LAST_CLICKED != null) &&
(e.IsFromDetailTable == false))
{
QC_LIST = QUEUE_CONTENTS.READDB(u, QB_LAST_CLICKED);
}
}
HDQueueGrid.DataSource = QC_LIST;
}
------------------------------------------
I have confirmed that the datasource does in fact get populated. I just cannot seem to visually show the data. The display content area which "hosts" the grid control is blank.
In case you wish to see my Ajax Manager code:
<telerik:RadAjaxManager runat="server" ID="MyQueuesAjaxManager"
OnAjaxRequest="MyQueuesAjaxManager_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="HDQueuesTreeView">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="HDQueueGrid"
LoadingPanelID="HDAjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
I do not know if it is relevant but this snipped of code is located in the content panel with the TreeView control.
So what am I doing incorrectly? I would revert the project to using a data source on the grid except that I cannot seem to derive the selectedvalue from the treeview control. Those values are always an empty string. (The treeview control is bound to a List<QUEUE_BUTTON> objects)
The treeview is populated using in the page load event using:
if (u != null)
{
if (this.IsPostBack == false)
{
HDQueuesTreeView.DataSource = QUEUE_BUTTONS.READDB(u);
HDQueuesTreeView.DataBind();
}
}
------------------------------------------
Thank you for any pointers you can send my way.