开发者

access Gridview attributes in javascript

I want to change the font size of my gridview in javascript because i am creating a printable version. How can I change th开发者_如何学运维e font size in javascript for the gridview?


With a gridview named GridView1 some javascript code like:

document.getElementById('<%=GridView1.ClientID%>').style.fontSize = "12px";


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜