Whenever I click on a node and retrieve data back from the database and want to place that data on the screen (outside the TreeView), the screen is not populated with that data.
I have the following markup in a RadAjaxManager which should AJAXify the TreeView.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadTreeView1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
If I take the above HTML out of the markup, the population of the data on the screen works fine (this, however, is a non-AJAXified resolution). I even tried just placing the Treeview within a RadUpdatePanel and the same result happened.
Here is my codebehind for the event.
protected void RadTreeView1_OnNodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
var query = from f in DbContext.Facilities
from m in DbContext.Maps
from md in DbContext.MapDetails
from ms in DbContext.MapStatus
where f.FacilityID == m.FacilityID
&& m.Mapid == md.MapID
&& m.MapStatusID == ms.mapStatusID
&& md.MapFieldID == int.Parse(e.Node.Value)
&& f.IsActive == true
&& m.IsActive == true
&& md.IsActive == true
select new
{
m.Facility.FacilityName,
m.FileType.Description,
m.IsMultiRecordType,
m.FirstRecordIndicator,
m.RecordIndicatorStartPosition,
m.RecordIndicatorEndPosition,
m.Delimiter,
m.MapStatusID,
mapstatusdesc = ms.Description,
md.MapDetailID,
md.MapID,
md.MapFieldID,
md.StartPosition,
md.EndPosition,
md.RecordIndicator,
md.DataFormat,
md.IsComposite,
md.CompositeSeparator,
md.SpecialCharactersRemoval,
md.WhenStartPosition,
md.WhenEndPosition,
md.WhenRecordIndicator,
md.WhenCompareID,
md.WhenCompareValue
};
foreach (var q in query)
{
// Retrieve Header Info
Label facilityname = mapHeader1.FindControl("facility") as Label;
facilityname.Text = q.FacilityName;
Label filetype = mapHeader1.FindControl("FileType") as Label;
filetype.Text = q.Description;
Label startpos = mapHeader1.FindControl("startPos") as Label;
startpos.Text = q.RecordIndicatorStartPosition.ToString();
Label endpos = mapHeader1.FindControl("endPos") as Label;
endpos.Text = q.RecordIndicatorEndPosition.ToString();
CheckBox MRT = mapHeader1.FindControl("MRT") as CheckBox;
MRT.Checked = q.IsMultiRecordType;
Label delimiter = mapHeader1.FindControl("delimiter") as Label;
delimiter.Text = q.Delimiter.ToString();
Label testProd = mapHeader1.FindControl("testProd") as Label;
testProd.Text = q.mapstatusdesc;
// Retrieve Detail Info
recordIndicator.Text = q.RecordIndicator;
startPosition.Text = q.StartPosition.ToString();
endPosition.Text = q.EndPosition.ToString();
ddlDataFmt.SelectedItem.Text = q.DataFormat;
chkCompositeField.Checked = q.IsComposite;
txtSeparator.Text = q.CompositeSeparator;
txtSpecialCharRemoval.Text = q.SpecialCharactersRemoval;
whenStartPosition.Text = q.WhenStartPosition.ToString();
whenEndPosition.Text = q.WhenEndPosition.ToString();
whenRecordIndicator.Text = q.WhenRecordIndicator;
if (q.WhenCompareID == null)
drpCompare.SelectedValue = "0";
else
drpCompare.SelectedValue = q.WhenCompareID.ToString();
}
}
According to the below directions on your website for using AJAX with the Treeview, the above solution should work fine:
Make telerik RadTreeView work with AJAX requests (Ajax-enable Telerik RadTreeView)
You can ajaxify any member of the telerik RadControls for ASP.NET suite. The ajax-enabled control will work in AJAX mode and will perform callback requests instead of regular postbacks.
To do so, you have two possible options:
place the instance of RadTreeView into an AjaxPanel - in this case, the control will update itself and all other controls in the panel via AJAX request
place one AJAX Manager on the page and in its property builder set the AJAX pair, i.e. AJAX initiator and the updated control. In this case, as we want Telerik RadTreeView to update itself with AJAX, it should be set as initiator and updated control.
Please post a solution as soon as you can for this.
Below, is the rest of the HTML for the page just in case you need it for additonal evaluation. Fyi, the Treeview is on the left side of the page and the population of the data occurs in the middle of the page with some simple textboxes, etc.
Thanks in advance,
Bill.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadTreeView1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<body>
<center>
<form name="theform">
<div>
<table id="Table5" width="100%" cellpadding="1" cellspacing="1" border="0">
<tr valign="top">
<td width="90%">
<uc1:mapHeader ID="mapHeader1" runat="server" />
<br />
</td>
<td>
<fieldset>
<legend>Action</legend>
<table id="Table6" width="100%" runat="server" cellpadding="1" cellspacing="1" border="0">
<tr>
<td class="td_AEVNoBold" align="center">
<asp:Button ID="btnValidation" runat="server" Text="Validate Map" Width="100px" Height="29px"
OnClick="btnValidation_Click" />
</td>
</tr>
<tr>
<td class="td_AEVNoBold" align="center">
<asp:Button ID="btnExecMap" runat="server" Text="Run Map" Width="100px" Height="29px"
Enabled="false" OnClick="btnExecMap_Click" />
</td>
</tr>
<tr>
<td class="td_AEVNoBold" align="center">
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<table width="100%" cellpadding="1" cellspacing="1" border="1">
<tr valign="top">
<td width="15%">
<asp:Panel ID="pnlMapFields" runat="server" ScrollBars="Both" Height="430px">
<telerik:RadTreeView ID="RadTreeView1" runat="server" DataTextField="Description"
DataFieldParentID="MapFieldparentID" DataFieldID="MapFieldID" DataValueField="MapFieldID"
OnClientNodeClicking="onNodeClicking" CausesValidation="false" OnNodeClick="RadTreeView1_OnNodeClick">
</telerik:RadTreeView>
</asp:Panel>
</td>
<td>
<fieldset>
<legend>
<asp:Label ID="FieldName" runat="server" Font-Bold="true" ForeColor="Blue"></asp:Label></legend>
<br />
<table id="Table1" width="100%" runat="server" cellpadding="1" cellspacing="1">
<tr valign="top">
<td colspan="2">
<table id="Table7" width="100%" runat="server" cellpadding="1" cellspacing="1">
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Mapping Field Name:
</td>
<td class="td_AEVNoBold">
<asp:Label ID="MappingField" runat="server" Font-Bold="true"></asp:Label>  (
<asp:Label ID="mapValue" runat="server" Font-Bold="true" ForeColor="blue"></asp:Label>
)
</td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtRec" runat="server" Width="100%" onMouseUp="mouseUP();"></asp:TextBox>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td width="50%">
<table id="Table3" width="100%" runat="server" cellpadding="1" cellspacing="1">
<tr valign="top">
<td class="td_AEVNoBold">
Record Indicator:
</td>
<td class="td_AEVNoBold">
<asp:TextBox ID="recordIndicator" runat="server" Width="50px" Enabled="false"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvRecdIndicator" runat="server" ErrorMessage="Record Indicator required ONLY for Multiple records!"
ControlToValidate="recordIndicator" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="31%">
Start Position:
</td>
<td class="td_AEVNoBold">
<telerik:RadNumericTextBox ID="startPosition" runat="server" Type="Number" Width="50px">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvStartPos" runat="server" ErrorMessage="Start Position required!"
ControlToValidate="startPosition" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold">
End Position:
</td>
<td class="td_AEVNoBold">
<telerik:RadNumericTextBox ID="endPosition" runat="server" Type="Number" Width="50px">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvEndPos" runat="server" ErrorMessage="End Position required!"
ControlToValidate="endPosition" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
<td>
<asp:CompareValidator ID="cvStartEndPos" runat="server" ErrorMessage="End Position cannot be less than Start Position!"
ControlToValidate="startPosition" ControlToCompare="endPosition" Operator="LessThanEqual"
Type="Integer" Font-Bold="true"></asp:CompareValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold">
Data Format:
</td>
<td class="td_AEVNoBold">
<asp:DropDownList ID="ddlDataFmt" runat="server" DataSourceID="LinqFieldTypeID" DataTextField="FieldTypeDesc"
DataValueField="FieldTypeID" AppendDataBoundItems="true">
<asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
</asp:DropDownList>
<asp:LinqDataSource ID="LinqFieldTypeID" runat="server" ContextTypeName="DataNet.Data.dataNetDataContext"
Select="new (FieldTypeDesc,FieldTypeID)" TableName="FieldTypes">
</asp:LinqDataSource>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvDataFmt" runat="server" ErrorMessage="Data Format required!"
ControlToValidate="ddlDataFmt" Font-Bold="true"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
<td width="50%">
<table id="Table4" width="100%" runat="server" cellpadding="1" cellspacing="1">
<tr valign="top">
<td class="td_AEVNoBold" width="30%">
Is a Composite Field:
</td>
<td class="td_AEVNoBold">
<asp:CheckBox ID="chkCompositeField" runat="server" AutoPostBack="true" OnCheckedChanged="chkCompositeField_OnCheckedChanged" />
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold">
Separator:
</td>
<td class="td_AEVNoBold">
<asp:TextBox ID="txtSeparator" runat="server" Width="50px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvSeparator" runat="server" ErrorMessage="Separator required when Composite selected!"
ControlToValidate="txtSeparator" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Map Sequence:
</td>
<td class="td_AEVNoBold">
<telerik:RadNumericTextBox ID="txtMapSeq" runat="server" Width="50px">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
<asp:RequiredFieldValidator ID="rfvMapSeq" runat="server" ErrorMessage="Map Sequence required when Composite selected!"
ControlToValidate="txtMapSeq" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Special Characters Removal:
</td>
<td class="td_AEVNoBold">
<asp:TextBox ID="txtSpecialCharRemoval" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvSpecialCharRemoval" runat="server" ErrorMessage="Special Characters Removal required when Composite selected!"
ControlToValidate="txtSpecialCharRemoval" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td colspan="2">
<fieldset>
<legend><b>ONLY WHEN</b></asp:Label></legend>
<table id="Table2" width="100%" runat="server" cellpadding="1" cellspacing="1">
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Start Position:
</td>
<td class="td_AEVNoBold">
<telerik:RadNumericTextBox ID="whenStartPosition" runat="server" OnTextChanged="whenStartPosition_OnTextChanged"
AutoPostBack="true">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvWhenStartPos" runat="server" ErrorMessage="*When* Start Position required if filling in 1 or more items in this section!"
ControlToValidate="whenStartPosition" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
End Position:
</td>
<td class="td_AEVNoBold">
<telerik:RadNumericTextBox ID="whenEndPosition" runat="server" OnTextChanged="whenEndPosition_OnTextChanged"
AutoPostBack="true">
<NumberFormat DecimalDigits="0" />
</telerik:RadNumericTextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvWhenEndPos" runat="server" ErrorMessage="*When* End Position required if filling in 1 or more items in this section!"
ControlToValidate="whenEndPosition" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
<td>
<asp:CompareValidator ID="cvWhenStartEndPos" runat="server" ErrorMessage="*When* End Position cannot be less than *When* Start Position!"
ControlToValidate="whenStartPosition" ControlToCompare="whenEndPosition" Operator="LessThanEqual"
Enabled="false" Type="Integer" Font-Bold="true"></asp:CompareValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Record Indicator:
</td>
<td class="td_AEVNoBold">
<asp:TextBox ID="whenRecordIndicator" runat="server" OnTextChanged="whenRecordIndicator_OnTextChanged"
AutoPostBack="true"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvWhenRecdInd" runat="server" ErrorMessage="*When* Record Indicator required ONLY for Multiple records if filling in 1 or more items in this section!"
ControlToValidate="whenRecordIndicator" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Compare:
</td>
<td class="td_AEVNoBold">
<asp:DropDownList ID="drpCompare" runat="server" Enabled="false">
<asp:ListItem Value="0" Text="Equal To" Selected="True"></asp:ListItem>
<asp:ListItem Value="1" Text="Not Equal To"></asp:ListItem>
<asp:ListItem Value="2" Text="Greater Than"></asp:ListItem>
<asp:ListItem Value="3" Text="Greater Than and Equal To"></asp:ListItem>
<asp:ListItem Value="4" Text="Less Than"></asp:ListItem>
<asp:ListItem Value="5" Text="Less Than and Equal To"></asp:ListItem>
</asp:DropDownList>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvCompare" runat="server" ErrorMessage="*When* Compare required ONLY for Multiple records if filling in 1 or more items in this section!"
ControlToValidate="drpCompare" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
Value:
</td>
<td class="td_AEVNoBold">
<asp:TextBox ID="value" runat="server" OnTextChanged="whenvalue_OnTextChanged" AutoPostBack="true"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="rfvValue" runat="server" ErrorMessage="*When* Value required ONLY for Multiple records if filling in 1 or more items in this section!"
ControlToValidate="value" Font-Bold="true" Enabled="false"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
<tr valign="top">
<td class="td_AEVNoBold" width="15%">
</td>
<td class="td_AEVNoBold">
<asp:Button ID="Save" runat="server" Text="Save" Width="150" OnClick="Save_Click" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Panel ID="Data" runat="server" GroupingText="Data" Width="100%">
<asp:ListBox ID="lstData" runat="server" Width="100%" Font-Size="XX-Small" onchange="lstData_onClick();">
</asp:ListBox>
</asp:Panel>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</div>
</form>
</center>
</body>