Using DataBinder.Eval() in style attribute of an asp.net control

前端 未结 4 1470
长情又很酷
长情又很酷 2020-12-11 01:02

I\'ve a asp.net linkbutton inside asp.net repeater control which renders multiple link buttons. I want to set the style of each and every linkbutton dynamically.

I\'

4条回答
  •  心在旅途
    2020-12-11 01:52

    We can also use trenary operator within it-- to custom the font size

    style='<%# "color:#6D7B8D;font-size:"Convert.ToInt32(DataBinder.Eval(Container.DataItem, "fontSize"))<5?"40":"30");" %>'
    

提交回复
热议问题