How to edit CSS style of a div using C# in .NET
Tags: c#,.net,css
Problem :
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>
Solution :
Add the runat="server"
attribute to it so you have:
<div id="formSpinner" runat="server">
<img src="images/spinner.gif">
<p>Saving...</p>
</div>
That way you can access the class attribute by using:
formSpinner.Attributes["class"] = "classOfYourChoice";
It's also worth mentioning that the asp:Panel
control is virtually synonymous (at least as far as rendered markup is concerned) with div
, so you could also do:
<asp:Panel id="formSpinner" runat="server">
<img src="images/spinner.gif">
<p>Saving...</p>
</asp:Panel>
Which then enables you to write:
formSpinner.CssClass = "classOfYourChoice";
This gives you more defined access to the property and there are others that may, or may not, be of use to you.
CSS Howto..
Right click on the area and "Inspect Element" Inside <div class="shield-container></div> you can see the following css animation See the CSS section of the debug tools to see what css...
Support was added to less.js and dotless in version 1.3 You have to use brackets and an escaping string.. e.g. (~".@{scope} .another") { color: #fff; } Edit This format is...
Hmmm...will ensureInjected() do what I want? Can I just define a CssResource and a ClientBundle that references that CssResource and then call ensureInjected on the CssResource and it will...
You want the {position:fixed} style as well. That will make the top and left be relative to the browser viewport.
You can can apply display:table-cell to the #a and #b and white-space:nowrap to force #a not to wrap inner <input>s in a column but display them in one row. Example...
JSP is really just HTML by the time it reaches the browser. CSS should be imported in the head element of the HTML document, not the body. CSS can be...
jQuery animate() adds overflow: hidden by default during all animations. A simple way to get round this is to set overflow: visible !important; on the element that is being animated....
There is an error( which I mentioned above in my comments) in the above jsfiddle example. Here is the fix : // Mousedown or touchstart function mousedown(e, space) { var...
As I understand it you need footer to be on the left side of the sidebar when content height is smaller and full width bellow sidebar when content is higher....
The W3C specification you linked to says it's currently in "Working Draft" stage. Also, there's no mention of the all property on CanIUse.com, so I think it's safe to say...
SAMPLE FIDDLE: http://jsfiddle.net/apTFp/ div{ position:absolute; top:0px; bottom:0px; left:0px; right:0px; background-color:#eeeeee; } This should work :)...
<mvc:resources mapping="/resources/**" location="/resources/" /> According to above line,you should make sure that your css files is under location="/resources/"(resources folder).If they are present in some other folder make change location path....
To change the color of the anchor in the last list-item , use : .last a{ color:black; } This would also work, using the :last-child selector: li:last-child a{ color:black; }...
Blockquote Two things are happening here. You are not using the container class properly. You are trying to override Bootstrap's CSS for the container class Bootstrap uses a grid...
In the css for .container, change position:relative to position:fixed Then adjust the top and left values accordingly http://jsfiddle.net/LMqSB/4/...
This method works across email clients: <table bgcolor="#3399ff" style="background:#3399ff;"><tr><td>test</td></tr></table> ...
Try this (DEMO): <ul class="nav menu"> <li class="item-101 current active parent"><a href="/">Item 1</a> </li> <li class="item-102 parent"><a href="/index.php/item2">Item 2</a> </li> <li class="item-103 parent"><a href="/index.php/item3">Item 3</a>...
No, never create an specific CSS styles set for an specific size. Instead, try always to use relative sizes (with percentages). For example: instead of width: 150px, let it be...
It appears to be working fine. I'm using iOS Simulator (an official Apple tool). I tried both the iPhone and iPad. Are you experiencing a caching issue?
Use removeClass and addClass: $(".galImg").click(function () { var image = $(this).attr("rel"); $('#feature').html('<img src="' + image + '"/>'); $('.galImg').removeClass('active'); $(this).addClass('active'); }); DEMO...
Try removing category module ( position - header left) from admin panel > Design > Layout > Your layout name (Home) . If possible put more code from catalog/view/theme/applied_theme_name/template/common/home.tpl file...
Something like this? http://jsfiddle.net/TweNm/ The idea is to wrap the <table> in a non-statically positioned <div> which has an overflow:auto CSS property. Then position the elements in the <thead> absolutely....
$(".main").click(function(){ $(this).find("li").each(function() { console.log($(this).attr('id')) }) }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <li class="main"><a href="#">QA</a> <ul> <li id="current_status"><a...
There are no silly questions! we all started exactly where you are :) First off as Trevor has said you have 2 position properties assigned to this element when you...
If you want to do this in css only you have to create divs for every column, and float those columns (but it messes up order of images). Alternatively, you...
this is known IE issue you may try with img.imageclassname { background: transparent; -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE8 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); /* IE6 & 7 */ }...
Your approach with margin and width to fake a rotation is very interesting, but you can do this much more simply with rotateY .cards { width: 800px; margin:auto; -webkit-perspective:1000; }...
you could do something like this date: formats: styled: ! '<span class="day">%-d</span> <span class="month">%b</span> <span class="year">%Y</span>' use that format <span class="date"><%= l Date.today, format: :styled %></span> and then specify css...
I think I've found a solution, using this answer as the basis: http://stackoverflow.com/a/16771324/126636 div { border: 3px solid; margin: 3px; padding: 3px; } .boxes-outer { border-color: green; min-height: 250px; display:...
$('.test:not(:has(h1))').css('font-size', '30px'); .test { font-size: 20px; color: #000; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="test"> <h1>This is a test</h1> <p>Welcome to the test</p> </div> <div...