1

So I tried to change the value of the z-index of a div inside c#.

I tried it like that: https://msdn.microsoft.com/en-us/library/system.web.ui.attributecollection.cssstyle(v=vs.110).aspx

So now I can use the div inside of the c# with runat="server" but the CssStyle doesnt work.

div1.CssStyle.Add("z-index", "-1");

It can't find it but i'm using using System.Web.UI;

What do I need to use CssStyle?

Thanks

1 Answer 1

1

You are using a <div runat="server">/div> tag, not the builtin panel.

You have 3 possibilities:

First

div1.Style.Add("z-index", "-1");

Second

div1.Attributes.Add("z-index", "-1");

Third

Change the div tag into <asp:Panel runat="server"></asp:Panel>, then you can use the property CssStyle.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.