开发者

IE screwiness (won't render empty cell in asp:listview)

I have an asp:listview using a css class. On my dev system (VS2008), it renders correctly in Chrome, IE and FireFox. On our production server (IIS 2.0), IE wil开发者_运维百科l not apply the style to an empty cell - but cells that contain text/whatever are fine. Chrome and FireFox still render fine. The style I want is a thin line on the bottom of each row, kind of like a row separator. Any idea what I can try to fix this?

Here is the css I assign to the Item and AltItem templates

.itemtemplate
{
    background-color: White;
}
.itemtemplate TD
{
  border-bottom:solid 1px #eae9e1; 
  border-right:solid 1px #eae9e1;
}

Oh, one other thing. If I change the background color in the css to say, orange, then the empty cells render with a border.


In IE, a cell must have content of some kind to be displayed properly. Try programmatically adding an   entity to create empty content.

Edit:
To make sure that the   makes it into the html you may need to run your Eval through a method and return the result of the method:

...Text='<%# GetItemText(Eval("EmployeeNumber").ToString()) %>'

With the code behind like:

public string GetItemText(string empNum)
{
    return (String.IsNullOrEmpty(empNum) ? "&nbsp;" : empNum;
}


Put &nbsp; into your empty cell.

If I remember correctly, the <td> isn't supposed to be empty ever according to the HTML spec anyways, so you really should always have something in the cell.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜