I'm trying to set the fontWeight for the elements in a RadGrid with no luck. I can set Name, color, size, etc.. but no luck setting the fontWeight.
Does anyone know how to do this?
var myRadGrid = $find("<%=RadGrid1.ClientID%>");
myRadGrid.MasterTableView.get_element().style.fontSize = "6px" //works fine
myRadGrid.MasterTableView.get_element().style.fontWeight = "Bold" //doesn't work
myRadGrid.MasterTableView.get_element().style.fontWeight = "800" //doesn't work
myRadGrid.MasterTableView.get_element().style.font.bold = true //doesn't work
7 Answers, 1 is accepted

Please try to set the RadGrid propery ItemStyle-Font-Bold and AlternatingItemStyle-Font-Bold to true as follows.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
ItemStyle-Font-Bold
=
"true"
AlternatingItemStyle-Font-Bold
=
"true"
>
<
MasterTableView
>
<
Columns
>
...
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks,
Shinu.

Shinu thank you for the response, but I instead need to change this via a client-side method call which is why I'm referencing as such below:
MasterTableView.get_element().style.font
Any ideas on how to do it that way?

Please have a look into the sample code snippet which works fine at my end.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"SqlDataSource1"
>
<
MasterTableView
>
<
Columns
>
...
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnGridCreated
=
"OnGridCreated"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
JavaScript:
<script type=
"text/javascript"
>
function
OnGridCreated(sender, args) {
sender.MasterTableView.get_element().style.fontSize =
"10px"
;
sender.MasterTableView.get_element().style.fontWeight =
"800"
;
}
</script>
Thanks,
Shinu.

Shinu thanks again for the help, I unfortunately am getting the same result. I tried setting both of these attributes as you mentioned and nothing at all changed:
ItemStyle-Font-Bold and AlternatingItemStyle-Font-Bold
changing it via javascript as you have it below also does nothing:
sender.MasterTableView.get_element().style.fontWeight =
"800"
;
I'm at a complete loss here, I can change everything about the text except for the fontWeight... looks like I'm going to have to mock up something to send in a ticket for support.
I also tested the Shunu's approach on my end and the fontWeight is properly applied/ See the screenshot of my local results.
If the issue still appear it will be best if you could open a regular support ticket and send us sample runnable application which demonstrates the problem. Thus w will be able to inspect it locally and advise you further.
Regards,
Maria Ilieva
Telerik

Agreed, I've mocked up a separate project and the issue does not surface. Shinu and your project are spot on and I'm at a loss as to why my main application RadGrid is having such an issue. I'm in the process of tearing it all apart to identify the culprit as its very strange that I can apply various different changes to the font just not the weight property.
Thank you both for your time in responding and attached project
In case you are still facing the issue you could send us the original problematic project in a regular support ticket so that we could further investigate the issue and do our best to provide proper solution.
Regards,
Maria Ilieva
Telerik