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

[Solved] Set font size in ItemDataBound event

2 Answers 233 Views
Grid
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 10 Jul 2009, 02:45 PM
Hi. I have a grid that's displaying a record for each day of the week, and under that record there are other records related to that day. What I need to do is set the font sizes to be different depending upon whether or not the record is displaying the week day. The problem I'm having is that I'm setting these types of properties (colors etc.) in the ItemDataBound event and the font property is read only there.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 10 Jul 2009, 03:40 PM
Hello William,

Please, try the following approach:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridDataItem) 
        if ((e.Item as GridDataItem)["myColumn"].Text == "1"
            e.Item.Style["font-size"] = "22px"

Let me know whether this helps.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
William
Top achievements
Rank 1
answered on 10 Jul 2009, 04:11 PM
Perfect! Thanks a lot Daniel.
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Daniel
Telerik team
William
Top achievements
Rank 1
Share this question
or