Reputation: 155
I have a asp:gridview with a header and paging but I'm wonderig that the vertical border to the left of the header is missing as shown in the image below (it is to the left of the string "Postnummer"):
As it can be seen it is only this little part of the gridview that is missing - every other border works correctly.
The declaration of the gridview is as follows:
<asp:GridView ID="gvPost" AutoGenerateColumns="False"
EnableViewState="true"
EmptyDataText="Listen er tom!" runat="server" CellPadding="4"
ForeColor="#333333" Font-Size="Small" AutoPostBack="True"
CssClass="Gridview"
DataKeyNames="Postnummer"
DataSourceID="odsRecords"
AllowPaging="true"
OnPageIndexChanging="gvPost_PageIndexChanging"
AllowSorting="True"
PageSize="50" GridLines="Both"
ShowFooter="false" OnRowDataBound="gvPost_RowDataBound">
So what can I do to show this part of the vertical border?
I hope that someone can give me a hint.
Thanks in advance
Michael
Upvotes: 1
Views: 364
Reputation: 155
The solution is as follows:
protected void gvPost_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[0].Style.Add("border-left-color", "#000000");
}
}
Upvotes: 1
Reputation: 436
you should do it in the background like below
protected void gvPost_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (TableCell tc in e.Row.Cells)
{
tc.Attributes["style"] = "border-color: #000000";
}
}
Upvotes: 1