have Implemented telerik Tree-view in page and populating node using web-service.
Source code look like
Javascript
webmethod
When I click on expand arrow then through javascript function web method is called to populate child node, it's worked perfect, I have issue in performance when parent node have 1000+ child nodes, I want to implement in batch mode like when user click on expand arrow then load 200 child node with more button then click on more button then load next 200 node. can any one have idea to achieve this feature.
Thanks,
Mohmedsadiq.
Source code look like
<
telerik:RadTreeView
ID
=
"tvNodes"
runat
=
"server"
EnableDragAndDrop
=
"false"
ExpandAnimation-Type
=
"OutExpo"
ExpandAnimation-Duration
=
"800"
EnableDragAndDropBetweenNodes
=
"false"
CollapseAnimation-Type
=
"OutElastic"
CollapseAnimation-Duration
=
"800"
Skin
=
"Windows7"
OnNodeDrop
=
"tvNodes_HandleDrop"
ClientNodePopulating
=
"nodePopulating"
>
<
ContextMenus
>
<
telerik:RadTreeViewContextMenu
ID
=
"NodesTreeMenu"
runat
=
"server"
CssClass
=
"MenuGroup"
Skin
=
"Windows7"
>
<
CollapseAnimation
Type
=
"none"
/>
</
telerik:RadTreeViewContextMenu
>
</
ContextMenus
>
<
WebServiceSettings
Path
=
"../ManageNode.asmx"
Method
=
"GetNodes"
>
</
WebServiceSettings
>
</
telerik:RadTreeView
>
function
nodePopulating(sender, eventArgs) {
var
node = eventArgs.get_node();
var
context = eventArgs.get_context();
SelectedType =
'1'
//selected node id.
SearchText =
''
context[
"ParentID"
] = node.get_value();
context[
"AllowDragAndDrop"
] = allowDragDrop;
context[
"SelectedType"
] = SelectedType;
context[
"SearchText"
] = SearchText;
}
[WebMethod]
public
RadTreeNodeData[] GetNodes(RadTreeNodeData node,
object
context)
{
IDictionary<
string
,
object
> contextDictionary = (IDictionary<
string
,
object
>)context;
List<RadTreeNodeData> nodes =
new
List<RadTreeNodeData>();
int
parentID = Convert.ToInt32(contextDictionary[
"ParentID"
]);
bool
AllowDragAndDrop = Convert.ToBoolean(contextDictionary[
"AllowDragAndDrop"
]);
int
selectedType = Convert.ToInt32(contextDictionary[
"SelectedType"
]);
string
SearchText = Convert.ToString(contextDictionary[
"SearchText"
]);
dsNodes = NodeBLL.GetAllRecordsByNodeDefinition(selectedType, parentID, SearchText.Trim());
for
(
int
rowCount = 0; rowCount < dsNodes.Tables[0].Rows.Count; rowCount++)
{
DataRow childRow = dsNodes.Tables[0].Rows[rowCount];
RadTreeNodeData childNode =
new
RadTreeNodeData();
if
(Convert.ToInt16(childRow[
"StatusID"
]) == Convert.ToInt16(Common.NodeStatus.Archieve))
{
childNode.Text = Common.DecodeXML(Convert.ToString(childRow[
"Name"
])) + Common.deleteFlag;
}
else
{
childNode.Text = Common.DecodeXML(Convert.ToString(childRow[
"Name"
]));
}
childNode.Value = Convert.ToString(childRow[
"ID"
]);
childNode.Attributes.Add(Common.virtualIDAtt, Convert.ToString(childRow[
"virtualID"
]));
childNode.Attributes.Add(Common.isVirtualExist, Convert.ToString(childRow[
"isVirtualExist"
]));
childNode.Attributes.Add(Common.NodeDefinitionID, Convert.ToString(childRow[
"NodeDefinitionID"
]));
childNode.Attributes.Add(Common.ParentNodeID, Convert.ToString(childRow[
"ParentID"
]));
childNode.Attributes.Add(Common.Position, Convert.ToString(childRow[
"Position"
]));
childNode.Attributes.Add(Common.NodeDefinition, Convert.ToString(childRow[
"NodeDefinition"
]));
childNode.ExpandMode = (Convert.ToInt32(childRow[
"ischildexists"
]) > 0) ? TreeNodeExpandMode.WebService : TreeNodeExpandMode.ClientSide;
nodes.Add(childNode);
}
return
nodes.ToArray();
}
Thanks,
Mohmedsadiq.