Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.net Table cell BorderStyle Bottom edge only

Posted on 2014-03-22
3
Medium Priority
?
3,283 Views
Last Modified: 2014-03-27
Hi

I am using the following VB.net code to set the border style of  a Table Cell in ASP.net to the Css Class shown further down. This affects all four borders of the cell. How do I only
affect the bottom border and leave the other three sides of the cell as blank or white.
I was shown an example of the xml code used to do this but I am dynamically building the table in VB.net

 Dim tCell As New TableCell()
 tCell.CssClass = "td"
  tRow.Cells.Add(tCell)

 td { border-bottom: double 2px black; }


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <style type="text/css">
        td.double-underline { border-bottom: double 2px black; }
    </style>
    <title></title>
</head>
<body>

    <form id="form1" runat="server">
    <div>
        <asp:Table>
            <asp:TableRow>
                <asp:TableCell CssClass="double-underline">Some content</asp:TableCell>
            </asp:TableRow>
        </asp:Table>
    </div>
    </form>

</body>
</html>
0
Comment
Question by:Murray Brown
3 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 39948837
Note the difference between your initial line of css and the one in the code example:
td { border-bottom: double 2px black; }

Open in new window

works on all td's whereas
td.double-underline { border-bottom: double 2px black; }

Open in new window

defines a new class that only works on td's of that class.

So you should use the second one and then change the dynamic assignment in the code accordingly:
tCell.CssClass = "double-underline"

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39948848
I just tested it and it works as inline style but not as css class.
0
 

Author Closing Comment

by:Murray Brown
ID: 39959643
thanks
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question