ASP.NET GridView inside repeater: gridlines disappear/reappear at random between rows when scolling through page

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.

Answers


Well this is embarrassing...

Apparently I must have accidently zoomed out a little bit on my webpage (CTRL + mousewheel down) some long time ago. Being zoomed out caused the gridlines, for some reason, to show improperly. The fact that they do not show propely when zoomed in/out on the page is not an issue for me. Can't believe I've spent almost seven hours before i figured it out.


Need Your Help

Is the C# static constructor thread safe?

c# multithreading singleton

In other words, is this Singleton implementation thread safe:

PHP script for a Piglatin program without regular expressions—how to take into account words that start with vowels, "th" or "sh"?

php arrays string if-statement foreach

Basically I'm trying to write a pretty basic program in PHP that just takes user input and translates it into Piglatin with PHP without using regular expressions. This is what my code so far looks ...