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

Set fontWeight for RadGrid clientSide

7 Answers 192 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 10 Dec 2013, 07:56 PM

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

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Dec 2013, 04:58 AM
Hi Erik,

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.
0
Erik
Top achievements
Rank 1
answered on 11 Dec 2013, 01:57 PM

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?

0
Shinu
Top achievements
Rank 2
answered on 12 Dec 2013, 03:36 AM
Hi Erik,

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.
0
Erik
Top achievements
Rank 1
answered on 14 Dec 2013, 02:44 AM

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.

0
Maria Ilieva
Telerik team
answered on 18 Dec 2013, 02:11 PM
Hi Erik,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Erik
Top achievements
Rank 1
answered on 18 Dec 2013, 02:15 PM

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

0
Maria Ilieva
Telerik team
answered on 21 Dec 2013, 12:42 PM
Hi Erik,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Erik
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Erik
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or