通过后面的代码设置Z-index [英] Set Z-index through code behind

查看:98
本文介绍了通过后面的代码设置Z-index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图将z-index设置为.cs页面的图像。

  for  int  j =  0 ; j< 10; j ++)
img [j] .Attributes.Add( style Z-INDEX:176; LEFT:144px; POSITION:absolute; TOP:111px );



向我显示错误'对象引用未设置为对象的实例。'



请帮忙。在此先感谢

解决方案

尝试

 img [index] .Style.Add(  Z-INDEX ); 


Hi,

I have tried to set z-index to an image from .cs page.

for(int j=0;j<10;j++)
img[j].Attributes.Add("style", "Z-INDEX: 176; LEFT: 144px; POSITION: absolute; TOP: 111px");


showing me an error 'Object reference not set to an instance of an object.'

Please help. Thanks in advance

解决方案

Try

img[index].Style.Add("Z-INDEX", "value");


这篇关于通过后面的代码设置Z-index的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆