Я думаю, что мое название объясняет проблему, которую я испытываю. Скриншот моей проблемы для более разъяснений: Gridlines not showing when I'm scolled to the top of my pageASP.NET GridView внутри ретранслятора: сетчатые линии исчезают/появляются случайно между рядами при сканировании через страницу
Gridlines showing when I'm scolled to the bottom of my page
Связанные код, .aspx файл:
<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>
Мой родственный код в .aspx.cs файле:
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();
}
}
}
Работа с данными работает так же, как и должно, отображая все в gridview.
Вот что я пытался в моем Gridview в файле .aspx:
GridLines="Both"
Не решить мою проблему. также попытался следующие в моей GridView:
CellPadding="4" CellSpacing="1" BackColor="White" RowStyle-BackColor="white" BorderStyle="Double" GridLines="Both"
Нет везения. В моем .aspx.cs файл в функции «rep_ItemDataBound()» функция, я попытался установить линии сетку, чтобы проверить, что работает:
//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";
ли не исправить мою проблему. Я также попытался установить границы для каждой ячейки/строки:
foreach (GridViewRow tr in g.Rows)
{
foreach (TableCell tc2 in tr.Cells)
{
tc2.Attributes["style"] = "border-color: #c3cecc";
}
}
ли не исправить мою проблему. Я много искал, чтобы узнать, есть ли проблема для моей проблемы, но я не могу найти ничего, что связано с моей проблемой.
Редактировать: Чтобы уточнить, я не касаюсь GridView/Repeater нигде в моем коде, только в коде, который я опубликовал. Ну, за исключением установки Datasource и DataBind для ретранслятора.