I’m trying to grab a div’s ID in the code behind (C#) and set some css on it. Can I grab it from the DOM or do I have to use some kind of control?
<div id='formSpinner'> <img src='images/spinner.gif' /> <p>Saving...</p> </div>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Add the
runat='server'attribute to it so you have:That way you can access the class attribute by using:
It’s also worth mentioning that the
asp:Panelcontrol is virtually synonymous (at least as far as rendered markup is concerned) withdiv, so you could also do:Which then enables you to write:
This gives you more defined access to the property and there are others that may, or may not, be of use to you.