내가 그리드 뷰가 내 aspx 페이지보다 넓기 때문에 가로 스크롤 막대로 스크롤하려면 gridview의 헤더가 필요하지만 세로 스크롤 막대로 고정 된 상태로 유지하려면 어떻게해야합니까? 이거 받아 들여? 도와주세요? 인터넷 검색을 많이 한 후에, 나는 내 창을 div 창 안쪽에 배치 한 후에 여러 CSS 클래스를 사용해 보았습니다.하지만 두 가지 방법으로 헤더를 가로 및 세로로 고정시킵니다. 수직 스크롤에서만 헤더를 수정하도록 도와주세요. position:fixed;
속성은 브라우저를 기반으로 위치에 구성 요소를 수정합니다고정 스크롤 그리드 뷰 헤더가 수직 스크롤에만
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div runat="server" id="GridViewDiv" style="overflow:auto" >
<asp:HiddenField ID="BindOnPostBack" Value="1" runat="server" />
<asp:GridView Width="100%" ID="ProjectsGridView" runat="server" AutoGenerateColumns="false"
OnRowCreated="BudgetGridView_RowCreated" OnRowDataBound="BudgetGridView_RowDataBound" PagerSettings-Visible="true" PageSize="20"
AllowPaging="true" AllowSorting="true" RowStyle-BackColor="#E8EAF7" RowStyle-BorderColor="White"
RowStyle-Height="19px" RowStyle-Font-Size="11px" RowStyle-HorizontalAlign="Left"
RowStyle-VerticalAlign="Middle" RowStyle-Font-Names="Tahoma,Helvetica,Arial"
HeaderStyle-BackColor="#d1d5ef" HeaderStyle-Height="22px" HeaderStyle-HorizontalAlign="Left"
HeaderStyle-Font-Names="Tahoma,Helvetica,Arial" HeaderStyle-Font-Size="13px"
HeaderStyle-Wrap="false" HeaderStyle-Font-Underline="false" RowStyle-Wrap="false"
PagerSettings-Position="Top" DataKeyNames="ID">
and my css for this:
div#GridViewDiv {
width: expression(document.getElementById("ctl00_contentPanel").style.width);
height: expression(document.getElementById("contentdiv").style.width);
overflow: scroll;
position: relative;
}
div#GridViewDiv th {
top: expression(document.getElementById("GridViewDiv").scrollTop - 2);
left: expression(parentNode.parentNode.parentNode.parentNode.scrollLeft);
position: relative;
z-index: 50;
}
td.locked, th.locked {
position:relative;
left:expression((this.parentElement.parentElement.parentElement.parentElement.scrollLeft-2)+'px');
}
HTML 및 CSS를 표시 할 수 있습니까? – bot
봇에 들러 주셔서 감사합니다. 관련 코드를 추가했는데, 이것에 대한 도움이 될 것입니다! – Viniez