table border attribute

Discussion in 'ASP .Net' started by rodchar, Mar 20, 2008.

  1. rodchar

    rodchar Guest

    hey all,
    is it possible to make the table border attribute dynamic? For example, is
    there a way to make it where i can set it in a style sheet?

    thanks,
    rodchar
     
    rodchar, Mar 20, 2008
    #1
    1. Advertisements

  2. Sure, just use the CSS border property. For example:

    <table style="border:2px solid black;">

    would give the table a solid black border with a width of 2px. You can
    obviously also use the other CSS border properties, such as border-width,
    border-style, border-color, etc. Something that I often do when modifying
    borders in tables is place the styles for the borders in the individual td
    tags so that I can do more customization for the table's appearance, but
    this can depend on your specific situation.
     
    Nathan Sokalski, Mar 20, 2008
    #2
    1. Advertisements

  3. rodchar

    Sam Allen Guest

    You could dynamically add text to a stylesheet so that you can change the
    border style based on some arbitrary logic. Style1.InnerText += "table {
    border: solid 1px black; }". That works well if you are using master pages
    and content pages. (Style1 is the id of the style element.)

    Sam
    http://dotnetperls.com/
     
    Sam Allen, Mar 20, 2008
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.