Reputation: 8078
I want to change the font size of my gridview in javascript because i am creating a printable version. How can I change the font size in javascript for the gridview?
Upvotes: 0
Views: 1889
Reputation: 27323
With a gridview named GridView1
some javascript code like:
document.getElementById('<%=GridView1.ClientID%>').style.fontSize = "12px";
Upvotes: 1
Reputation: 37533
There are a lot of ways to do it, but the method I would use if I were to attempt it is to get the unique ClientID of each control (label, TextBox, literal) in the gridview that I wanted to change and as it was going through the RowCreated event, I would inject the ClientID into an array of control names. Then when the action in JavaScript is executed, I'd simply need to traverse the array and set the style for each control. Using jQuery would even speed this up.
Upvotes: 1