Замораживание столбцов таблицы не работает в Google Chrome и Mircrosoft Edge - PullRequest
0 голосов
/ 19 марта 2020

Замораживание столбцов работает в Inte rnet Explorer, но после проверки в Google Chrome и Microsoft Edge не работает. Есть ли какое-либо возможное решение, чтобы заставить это работать для Chrome и Microsoft Edge (см. Коды ниже), или вы можете порекомендовать какое-нибудь лучшее решение, чтобы заморозить столбец таблицы, который может работать в другом браузере? Заранее спасибо.

IE: enter image description here

Google Chrome и Microsoft Edge: enter image description here

Неверное значение свойства enter image description here

Вот код:

   <style type="text/css">
        td.locked {
            border-top: 0px;
            border-right: 0px;
            position: relative;
            left: expression(document.getElementById("<%= pnlItemDetails.ClientID %>").scrollLeft-2410);
        }

        th.locked {
            border-right: 0px;
            position: relative;
            left: expression(document.getElementById("<%= pnlItemDetails.ClientID %>").scrollLeft-2410);
        }
   </style>

 Protected Sub gvwItemDetails_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvwItemDetails.RowDataBound

            Select Case e.Row.RowType
                Case DataControlRowType.DataRow

                    If e.Row.RowState = DataControlRowState.Alternate Then
                        ' Highlights the alternate row when hover
                        e.Row.Attributes.Add("onmouseover", "this.className='onmouseover_alternate'")
                        e.Row.Attributes.Add("onmouseout", "this.className='onmouseout_alternate'")
                        e.Row.Attributes.Add("class", "gridviewclass_alternate")
                    Else
                        ' Highlights the row when hover
                        e.Row.Attributes.Add("onmouseover", "this.className='onmouseover'")
                        e.Row.Attributes.Add("onmouseout", "this.className='onmouseout'")
                        e.Row.Attributes.Add("class", "gridviewclass")
                    End If

                    ' Lock last columns
                    e.Row.Cells(25).Attributes.Add("class", "locked")
                    e.Row.Cells(26).Attributes.Add("class", "locked")
                    e.Row.Cells(27).Attributes.Add("class", "locked")
                    e.Row.Cells(28).Attributes.Add("class", "locked")
                    e.Row.Cells(29).Attributes.Add("class", "locked")
                Case DataControlRowType.Header
                    ' Lock last columns
                    e.Row.Cells(25).Attributes.Add("class", "locked")
                    e.Row.Cells(26).Attributes.Add("class", "locked")
                    e.Row.Cells(27).Attributes.Add("class", "locked")
                    e.Row.Cells(28).Attributes.Add("class", "locked")
                    e.Row.Cells(29).Attributes.Add("class", "locked")
                Case DataControlRowType.Footer

                        e.Row.Cells(24).Attributes.Add("class", "locked")
                        e.Row.Cells(25).Attributes.Add("class", "locked")
                        e.Row.Cells(26).Attributes.Add("class", "locked")
                        e.Row.Cells(27).Attributes.Add("class", "locked")
                        e.Row.Cells(28).Attributes.Add("class", "locked")
                        e.Row.Cells(29).Attributes.Add("class", "locked")
                    End If
            End Select
    End Sub
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...