0
我有一個Treelist,我從值列表中填充它。我也得到選定的節點值。但是,當我想通過該值設置此文本框時,我失敗了。文本框中沒有任何內容。我怎樣才能通過這個selectednode值來填充文本框?如何設置AspxTreelist的重點節點的文本框文本
<dx:ASPxTreeList ID="ASPxTreeList1" runat="server" EnableTheming="True" Theme="Moderno" AutoGenerateColumns="True" KeyFieldName="ID" ParentFieldName="ReportsTo" Width="280px"
ClientInstanceName="treeList" OnCustomDataCallback="treeList_CustomDataCallback" >
<Columns>
<dx:TreeListTextColumn FieldName="ProjectName" VisibleIndex="0">
</dx:TreeListTextColumn>
<dx:TreeListTextColumn FieldName="ReportsTo" VisibleIndex="3" Visible="False">
</dx:TreeListTextColumn>
</Columns>
<Settings GridLines="Horizontal" ScrollableHeight="300" SuppressOuterGridLines="true" VerticalScrollBarMode="Visible" />
<Settings ShowColumnHeaders="False" ShowTreeLines="False" />
<SettingsBehavior AllowFocusedNode="True" />
<ClientSideEvents CustomDataCallback="function(s, e) { document.getElementById('messageText').innerHTML = e.result; }"
FocusedNodeChanged="function(s, e) {
var key = treeList.GetFocusedNodeKey();
treeList.PerformCustomDataCallback(key);
}" />
</dx:ASPxTreeList>
<dx:ASPxTextBox ID="txtSelectedNode" runat="server" Theme="Moderno" Width="170px">
</dx:ASPxTextBox>
<SettingsPager Mode="ShowAllNodes">
</SettingsPager>
<SettingsDataSecurity AllowDelete="False" AllowEdit="False" AllowInsert="False" />
</dx:ASPxTreeList>
protected void treeList_CustomDataCallback(object sender, TreeListCustomDataCallbackEventArgs e)
{
string key = e.Argument.ToString();
TreeListNode node = ASPxTreeList1.FindNodeByKeyValue(key);
if (!node.HasChildren)
{
txtSelectedNode.Text = node.GetValue("ProjectName").ToString();
}
}