Hello all,
I have a problem with RadTreeList when use DataBind in AJAX method.
This is ASPX
I have a problem with RadTreeList when use DataBind in AJAX method.
This is ASPX
<
telerik:RadAjaxManager
ID
=
"AjaxManager"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"btnSearch"
>
<
UpdatedControls
> <
telerik:AjaxUpdatedControl
ControlID
=
"rtlSearchResult"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
asp:Button
ID
=
"btnSearch"
OnClick
=
"btnSearchClick"
runat
=
"server"
/>
<
telerik:RadTreeList
runat
=
"server"
ID
=
"rtlSearchResult"
EnableNoRecordsTemplate
=
"true"
AllowPaging
=
"false"
PageSize
=
"5"
DataKeyNames
=
"_ID"
ParentDataKeyNames
=
"_ID_FOLDER"
Height
=
"250"
AllowLoadOnDemand
=
"false"
OnItemCommand
=
"rtlSearchResult_ItemCommand"
AutoGenerateColumns
=
"false"
Visible
=
"true"
>
<
Columns
>
<
telerik:TreeListBoundColumn
DataField
=
"_ID"
UniqueName
=
"_ID"
HeaderText
=
"ID"
></
telerik:TreeListBoundColumn
>
<
telerik:TreeListBoundColumn
DataField
=
"_NAME"
UniqueName
=
"_NAME"
HeaderText
=
"NAME"
></
telerik:TreeListBoundColumn
>
</
Columns
>
</
telerik:RadTreeList
>
CodeBehind
public
List<common.DOCUMENT_OBJECT_MAP> list;
protected
void
Page_Load(
object
sender, EventArgs e)
{
list =
new
List<common.DOCUMENT_OBJECT_MAP>();
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 1, NAME =
"Obj1"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 11, ID_FOLDER = 1, NAME =
"Obj11"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 12, ID_FOLDER = 1, NAME =
"Obj12"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 13, ID_FOLDER = 1, NAME =
"Obj13"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 14, ID_FOLDER = 13, NAME =
"Obj14"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 15, ID_FOLDER = 13, NAME =
"Obj15"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 16, ID_FOLDER = 14, NAME =
"Obj16"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 17, ID_FOLDER = 14, NAME =
"Obj17"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 18, ID_FOLDER = 14, NAME =
"Obj18"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 2, NAME =
"Obj2"
});
list.Add(
new
common.DOCUMENT_OBJECT_MAP() { ID = 3, NAME =
"Obj33"
});
if
(!IsPostBack)
{
rtlSearchResult.DataSource = list;
rtlSearchResult.DataBind();
}
}
protected
void
btnSearchClick(
object
sender, EventArgs e)
{
rtlSearchResult.DataSource = list;
rtlSearchResult.DataBind();
}
protected
void
rtlSearchResult_ItemCommand(
object
sender, TreeListCommandEventArgs e)
{
if
(e.CommandName == RadTreeList.ExpandCollapseCommandName)
{
rtlSearchResult.DataSource = list;
rtlSearchResult.DataBind();
}
}
When is no postback TreeList good work, exand and collapse nodes, but when I click to btnSearch I can't expand/collapse any node. Anybody could help me? Where is a bug?
Thanks!
Alexey