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

Row Template on Client Binding?

3 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Matthew
Top achievements
Rank 2
Matthew asked on 28 Sep 2010, 11:39 PM
Hello, I have a fairly simple app with a ajax bound MVC Grid.

My Rows have a color code (fore and back) in the model, and I'm able to set individual cells up using HTML client templates, but is there any way I can do something like RowAction() on the client side, and set HTML color attributes for a row with Ajax binding?

Thanks!
-Matt

3 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 29 Sep 2010, 07:32 AM
Hello Matthew,

 You can use the OnRowDataBound client event and use the row field of the event arguments to set color:

function onRowDataBound(e) {
     e.row.style.color = 'red';
}

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Matthew
Top achievements
Rank 2
answered on 29 Sep 2010, 03:12 PM
Thank you :)

You guys have been the best company software company I've had the pleasure of working with.


Now my only problem is, for each Item, I have a field lets say its called 'color', can I pass this into the onRowDataBound ie find it from e.Row.xyz? I'll take a look through the documentation.
Thanks,
-Matt
0
Matthew
Top achievements
Rank 2
answered on 29 Sep 2010, 03:24 PM
Got it.

Using the following(my model has HTMLColor and HTMLForeColor attributes)

   function onRowDataBound(e) {
            var backColor = e.dataItem.HTMLColor;
            var foreColor = e.dataItem.HTMLForeColor;



            e.row.style.color = foreColor;
            e.row.style.backgroundColor = backColor;
        }
Tags
Grid
Asked by
Matthew
Top achievements
Rank 2
Answers by
Atanas Korchev
Telerik team
Matthew
Top achievements
Rank 2
Share this question
or