2013-07-10 17 views
0

내가 그리드 뷰가 내 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'); 
} 
+0

HTML 및 CSS를 표시 할 수 있습니까? – bot

+0

봇에 들러 주셔서 감사합니다. 관련 코드를 추가했는데, 이것에 대한 도움이 될 것입니다! – Viniez

답변

0

내 aspx 페이지의

부분.

+0

div 위치는 브라우저에 상대적이어야하지만, 브라우저 크기를 줄이면 위치를 고정해도 잘 동작하지 않습니다! 또한, 그것은 기본 문제를 해결하지, 난 수직 스크롤에서만 머리글을 동결하고 수평 스크롤로 이동 유지해야합니다! – Viniez

+0

거기에 표준 방법이 없습니까? 나는 이것이 그리드 뷰의 매우 기본적인 필요라고 생각했다! 제발 도와주세요 .. 누군가가 이것을 구현했을 것입니다! – Viniez

+0

@Viniez 고정 위치를 사용하지 않았기 때문에 존재하지 않는다는 것 외에는 더 이상 지원할 수 없습니다. –

관련 문제