Results 1 to 3 of 3

Thread: How to set CSS style value from code-behind?

  1. #1
    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

  2. #2
    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.

  3. #3
    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.

Similar Threads

  1. Replies: 4
    Last Post: 19-02-2012, 04:29 PM
  2. Achron's Art Style
    By Skullnit in forum Video Games
    Replies: 5
    Last Post: 02-09-2011, 10:28 AM
  3. Is there a GTA-style DLC in L.A.Noire
    By BOGUMIL in forum Video Games
    Replies: 5
    Last Post: 02-06-2011, 10:17 PM
  4. Where to download style for VB
    By io78 in forum Software Development
    Replies: 3
    Last Post: 21-09-2009, 06:18 PM
  5. Inf style is different than what was requested
    By PeterT in forum Networking & Security
    Replies: 2
    Last Post: 25-05-2009, 11:56 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,662,893.86232 seconds with 17 queries