How to change font programmatically?

tantormedia
tantormedia used Ask the Experts™
on
Dear experts,

I need to provide for the user ability to change font size in all application's GridViews (td's and hd's). I have a dropdown box to select font size from. How can I make the selected size default for all GridViews?

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Thank you AmanBhullar,

But isn't it WinForms example?

Obadiah ChristopherDeveloper User Interface

Commented:
Maybe u could have a look at ASP.Net themes.

You could also store the value in web.config. At runtime read the font value from web.config.
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Author

Commented:
My problem is that I just don't know how to set the size programmatically.
E,g. I tried this:
    protected void btnSubmitMyAccount_Click(object sender, EventArgs e)
    {
        foreach (TableCell cell in Page.Controls.OfType<TableCell>())
        {
            cell.Font.Size = 20;
        }
    }
... and nothing happens.
Developer User Interface
Commented:
Grid.Style.Add("font-family","Verdana");

Author

Commented:
Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial