Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to set CSS style value from code-behind?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 13-05-2009
Member
 
Join Date: Apr 2009
Posts: 49
How to set CSS style value from code-behind?
  

I have developed my aspx page and I need that page width should be adjusted as per the requirement, i read regarding this issue in some blogs that this is possible through the code behind and i also read that this will be edited with the help of <DIV /> tag and then we need to add an ID value to it, but don't know how to implement it in real life.

Thanks

Reply With Quote
  #2  
Old 13-05-2009
Member
 
Join Date: Dec 2008
Posts: 202
Re: How to set CSS style value from code-behind?

I will provide you the C# code that will help you much more easier to setup your problem from the code-behind.

Code:
myDiv.attributes.Add("Style", "width:1000px;margin:0px auto")
This i have used as an simple outline to implement using the CSS style sheet, i am not providing you my code this is because that code would be different from yours but this will give you the better idea to do so.
Reply With Quote
  #3  
Old 13-05-2009
Member
 
Join Date: Dec 2008
Posts: 161
Re: How to set CSS style value from code-behind?

Yes you will require to use <DIV /> and also need to Use Style collection:
myDiv.Style["width"]="200px";

and if we are concerning about the <DIV /> then you need to replace the <div> with an <asp : Panel>. and It will help to produce the same html output but will give you better choice of server-side properties.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to set CSS style value from code-behind?"
Thread Thread Starter Forum Replies Last Post
How to make single page into Landscape page style and rest of them in default style in OpenOffice? Hridayeshu Windows Software 4 19-02-2012 03:29 PM
Achron's Art Style Skullnit Video Games 5 02-09-2011 10:28 AM
Is there a GTA-style DLC in L.A.Noire BOGUMIL Video Games 5 02-06-2011 10:17 PM
Where to download style for VB io78 Software Development 3 21-09-2009 06:18 PM
Inf style is different than what was requested PeterT Networking & Security 2 25-05-2009 11:56 AM


All times are GMT +5.5. The time now is 06:34 PM.