This is a migrated thread and some comments may be shown as answers.

Bug: Difference between setting CSS on client or server in what is rendered

1 Answer 49 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chris Crowe
Top achievements
Rank 1
Chris Crowe asked on 07 Aug 2008, 12:06 AM

I have a large rad tree view that is fully expanded with checkboxes enabled.

The problem I have is that this type of UI makes it hard for users to see which items are checked. The checkbox is small and the text does not show as being selected so the user has to scan each item to see if it is checked.

So I want to hightlight the checked nodes.

There appears to be a difference between the Server + Client setting of the CSS for nodes. On page load I set the css class by ServerSide and then when the user checks or unchecks on the client side I set it using client side events.

Server Side
RadTreeNode node = RadTreeView1.FindNodeByValue(ID);
node.CssClass = "RadNodeSelected";

Client Side
var node = eventArgs.get_node();
node.set_cssClass("RadNodeSelected");

If you make the cssClass "RadNodeSelected" have something like the following you really see the issue I have.

.RadNodeSelected
{
 font-weight: bold;
 color: Purple;
 border : Red dotted 5px;
}

This is what is rendered from the server side - as you can see the setting of the cssClass only applies to the SPAN for the text of the node.

<DIV class=rtTop><SPAN class=rtSp></SPAN><SPAN class=rtMinus></SPAN><INPUT
class=rtChk type=checkbox CHECKED><SPAN
class="rtIn RadNodeSelected">Trimble</SPAN> </DIV>

and when using the client side to set the CSS it applies to the DIV tag of the node and not the SPAN for the text.

node.set_cssClass("RadNodeSelected");

<DIV class="rtTop rtSelected RadNodeSelected"><SPAN class=rtSp></SPAN><SPAN
class=rtMinus></SPAN><INPUT class=rtChk type=checkbox CHECKED><SPAN
class="rtIn RadNodeSelected">Trimble</SPAN> </DIV>

and client side to remove the CSS

node.set_cssClass(null);

<DIV class="rtTop rtSelected"><SPAN class=rtSp></SPAN><SPAN
class=rtMinus></SPAN><INPUT class=rtChk type=checkbox><SPAN
class="rtIn RadNodeSelected">Trimble</SPAN> </DIV>

I am using RadControls for ASPNET AJAX Q1 2008 and I just noticed a new update for Q2 so I will pull that down and see if it has the same problem.

Am I just using the wrong methods to do what I want or is this a bug?

Chris

 

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 11 Aug 2008, 12:12 PM
Hi Chris Crowe,

Thank you for contacting Telerik support.

This issue has been resolved and is available since Q2, so please upgrade and you will stop experiencing the problem - styles will be rendered on the <span> elements of Nodes no matter how they are set (client- or server-side).

Sincerely yours,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Chris Crowe
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or