Hi, i'm having some kind of trouble while i try to use the Checked property of RadTreeNode, i want to use this property but i don't want to show the checkbox to my user.
This is how my code looks like:
I tried to set CheckBoxes to true and it worked but i don't want my users to see the checkbox.
Here's how i'm changing the Checked property:
I also tried to user Node.Attributes but unfortunately when i tried to get the values from Attributes at server side they were exactly the same as they were in the time of the databind.
Here's how i changed the Attributes from the node:
That's all, thanks
This is how my code looks like:
<
telerik:RadTreeView
OnClientNodeClicked
=
"ClientNodeClicked"
CheckBoxes
=
"false"
runat
=
"Server"
ID
=
"tvwMenuItens"
></
telerik:RadTreeView
>
I tried to set CheckBoxes to true and it worked but i don't want my users to see the checkbox.
Here's how i'm changing the Checked property:
function
ClientNodeClicked(sender, eventArgs) {
var
node = eventArgs.get_node();
var
toolBar = $find(
'<%= tlbSecurityProfile.ClientID %>'
);
var
saveButton = toolBar.findItemByValue(
'Save'
);
if
(node.get_text() !=
null
&& node.get_text() !=
''
) {
if
(node.get_value() !=
null
&& node.get_value() !=
''
) {
if
(saveButton.get_enabled()) {
if
(
node.get_checked()) {
node.set_checked(false
);
node.set_imageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_No_Access.png") %>'
);
node.set_selectedImageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_No_Access.png") %>'
);
}
else
{
node.set_checked(true
);
node.set_imageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_Has_Access.png") %>'
);
node.set_selectedImageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_Has_Access.png") %>'
);
}
}
}
}
}
I also tried to user Node.Attributes but unfortunately when i tried to get the values from Attributes at server side they were exactly the same as they were in the time of the databind.
Here's how i changed the Attributes from the node:
function
ClientNodeClicked(sender, eventArgs) {
var
node = eventArgs.get_node();
var
toolBar = $find(
'<%= tlbSecurityProfile.ClientID %>'
);
var
saveButton = toolBar.findItemByValue(
'Save'
);
if
(node.get_text() !=
null
&& node.get_text() !=
''
) {
if
(node.get_value() !=
null
&& node.get_value() !=
''
) {
if
(saveButton.get_enabled()) {
var
attributes = node.get_attributes();
if
(attributes.getAttribute(
"Checked"
) ==
"true"
) {
attributes.setAttribute(
"Checked"
,
"false"
);
node.set_imageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_No_Access.png") %>'
);
node.set_selectedImageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_No_Access.png") %>'
);
}
else
{
attributes.setAttribute(
"Checked"
,
"true"
);
node.set_imageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_Has_Access.png") %>'
);
node.set_selectedImageUrl(
'<%=Page.ResolveUrl("~/Images/TreeView/TreeView_Has_Access.png") %>'
);
}
}
}
}
That's all, thanks