I think my title explains the problem I'm having. Screenshot of my problem for more clarification: Gridlines not showing when I'm scolled to the top of my page
Gridlines showing when I'm scolled to the bottom of my page
Related code, .aspx file:
<asp:Repeater ID="rep" runat="server" OnItemDataBound="rep_ItemDataBound">
<ItemTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
EnableModelValidation="True"
Position=relative OnRowCommand="GridView1_RowCommand"
AllowPaging="false" ShowFooter="false"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
OnRowCreated="GridView1_RowCreated" OnRowDataBound="GridView1_RowDataBound"
Width="90%">
<Columns>
//a few TemplateFields with ItemTemplates inside of them,
and some DataBinder to display the information.
//I'm not doing anything with the border inside the TemplateFields.
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:Repeater>
My related code in .aspx.cs file:
protected void rep_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
foreach(Control c in e.Item.Controls)
{
if(c as Label != null)
{
GetIoTName(varv);
(c as Label).Text = "<br>" + GetIoTName(varv) + "</br>";
}
if (c as GridView != null)
{
(c as GridView).DataSource = AllConnectedDevices[varv];
(c as GridView).DataBind();
}
}
}
The databinding works just as it should, displaying everything in the gridview.
Here's what I've tried in my Gridview in .aspx file:
GridLines="Both"
Doesn't solve my problem. Also tried the following in my GridView:
CellPadding="4" CellSpacing="1" BackColor="White" RowStyle-BackColor="white" BorderStyle="Double" GridLines="Both"
No luck. In my .aspx.cs file in the function "rep_ItemDataBound()" function, I've tried to set the gridlines to test if that works:
//c is my control for the GridViev. This atleast changes the color for the GridView
GridView g = c as GridView;
g.Attributes["style"] = "border-color: #c3cecc";
Doesn't fix my problem. I've also tried to set the border for each cell/row:
foreach (GridViewRow tr in g.Rows)
{
foreach (TableCell tc2 in tr.Cells)
{
tc2.Attributes["style"] = "border-color: #c3cecc";
}
}
Does not fix my problem. I've searched a lot to see if there's a fix for my problem, but I can't find anything thats related to my problem.
Edit: Just to clarify, I'm not touching the GridView/Repeater anywhere else in my code, only in the code I've posted. Well, except for setting the Datasource and DataBind for the repeater.