2012-02-17 2 views
0

그래서이 ListView 사용자 정의 컨트롤을 VB에서 만들고 내 데이터 소스를 지정했습니다. 내가 사용한 레이아웃은 "단일 행"레이아웃이며 페이징이 활성화되었습니다. 그러나 결과는 행에 대해 정확히 10 열 (10 개의 창)입니다. 어떻게 기본 열을 5로 만들 수 있을지 궁금합니다. 속성을 확인한 결과 해당 행에 대해 시작할 열 수를 제어하는 ​​속성이없는 것으로 보입니다.VB에서 "단일 행"레이아웃에 대한 ListView의 열 수를 지정하는 방법

감사

편집 : 참조

<asp:ListView ID="ListView1" runat="server" DataSourceID="RssDataSource1"> 
     <ItemTemplate> 
      <td runat="server" style="background-color:#DCDCDC;color: #000000;"> 
       title: 
       <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' /> 
       <br /> 
       link: 
       <asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %>' /> 
       <br /> 
       description: 
       <asp:Label ID="descriptionLabel" runat="server" 
        Text='<%# Eval("description") %>' /> 
       <br /> 
       pubDate: 
       <asp:Label ID="pubDateLabel" runat="server" Text='<%# Eval("pubDate") %>' /> 
       <br /> 
       category: 
       <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' /> 
       <br /> 
      </td> 
     </ItemTemplate> 
     <AlternatingItemTemplate> 
      <td runat="server" style="background-color:#FFF8DC;"> 
       title: 
       <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' /> 
       <br /> 
       link: 
       <asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %>' /> 
       <br /> 
       description: 
       <asp:Label ID="descriptionLabel" runat="server" 
        Text='<%# Eval("description") %>' /> 
       <br /> 
       pubDate: 
       <asp:Label ID="pubDateLabel" runat="server" Text='<%# Eval("pubDate") %>' /> 
       <br /> 
       category: 
       <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' /> 
       <br /> 
      </td> 
     </AlternatingItemTemplate> 
     <EmptyDataTemplate> 
      <table style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;"> 
       <tr> 
        <td> 
         No data was returned.</td> 
       </tr> 
      </table> 
     </EmptyDataTemplate> 
     <InsertItemTemplate> 
      <td runat="server" style=""> 
       title: 
       <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' /> 
       <br /> 
       link: 
       <asp:TextBox ID="linkTextBox" runat="server" Text='<%# Bind("link") %>' /> 
       <br /> 
       description: 
       <asp:TextBox ID="descriptionTextBox" runat="server" 
        Text='<%# Bind("description") %>' /> 
       <br /> 
       pubDate: 
       <asp:TextBox ID="pubDateTextBox" runat="server" Text='<%# Bind("pubDate") %>' /> 
       <br /> 
       category: 
       <asp:TextBox ID="categoryTextBox" runat="server" 
        Text='<%# Bind("category") %>' /> 
       <br /> 
       <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
        Text="Insert" /> 
       <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
        Text="Clear" /> 
      </td> 
     </InsertItemTemplate> 
     <LayoutTemplate> 
      <table runat="server" border="1" 
       style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;"> 
       <tr ID="itemPlaceholderContainer" runat="server"> 
        <td ID="itemPlaceholder" runat="server"> 
        </td> 
       </tr> 
      </table> 
      <div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;"> 
       <asp:DataPager ID="DataPager1" runat="server"> 
        <Fields> 
         <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
          ShowNextPageButton="False" ShowPreviousPageButton="False" /> 
         <asp:NumericPagerField /> 
         <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
          ShowNextPageButton="False" ShowPreviousPageButton="False" /> 
        </Fields> 
       </asp:DataPager> 
      </div> 
     </LayoutTemplate> 
     <EditItemTemplate> 
      <td runat="server" style="background-color:#008A8C;color: #FFFFFF;"> 
       title: 
       <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' /> 
       <br /> 
       link: 
       <asp:TextBox ID="linkTextBox" runat="server" Text='<%# Bind("link") %>' /> 
       <br /> 
       description: 
       <asp:TextBox ID="descriptionTextBox" runat="server" 
        Text='<%# Bind("description") %>' /> 
       <br /> 
       pubDate: 
       <asp:TextBox ID="pubDateTextBox" runat="server" Text='<%# Bind("pubDate") %>' /> 
       <br /> 
       category: 
       <asp:TextBox ID="categoryTextBox" runat="server" 
        Text='<%# Bind("category") %>' /> 
       <br /> 
       <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
        Text="Update" /> 
       <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
        Text="Cancel" /> 
      </td> 
     </EditItemTemplate> 
     <SelectedItemTemplate> 
      <td runat="server" 
       style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;"> 
       title: 
       <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' /> 
       <br /> 
       link: 
       <asp:Label ID="linkLabel" runat="server" Text='<%# Eval("link") %>' /> 
       <br /> 
       description: 
       <asp:Label ID="descriptionLabel" runat="server" 
        Text='<%# Eval("description") %>' /> 
       <br /> 
       pubDate: 
       <asp:Label ID="pubDateLabel" runat="server" Text='<%# Eval("pubDate") %>' /> 
       <br /> 
       category: 
       <asp:Label ID="categoryLabel" runat="server" Text='<%# Eval("category") %>' /> 
       <br /> 
      </td> 
     </SelectedItemTemplate> 
    </asp:ListView> 
+0

데이터 원본에서 무엇을 반환합니까? 10 가지 값을받을 수 있습니까? 이 경우 5 개의 열만 추가하고 새 행을 원할 경우 코드 숨김에서 수행 할 수 있습니다. –

+0

Maarten, 실제로 19 개의 레코드가 있습니다. 사실 사용자가 첫 번째 5 레코드 이상을보고 싶다면 ListView 구성에서 사용할 수있는 다음 단추를 눌러 나머지 데이터 레코드를 슬라이드하고 볼 수 있습니다. – eastboundr

답변

0

내가 발견하는 페이저 제어에 지정할 수 있습니다 표시 할 레코드의 기본 번호 :

ASP :있는 DataPager ID = "DataPager1"RUNAT = "서버"페이지 크기 = "5"

GroupItemCount 속성과 함께 사용하면 문제가 해결됩니다. 어쨌든 도움을 주셔서 감사합니다.

0

에 대한 코드는 당신은 당신의 코드를 게시 할 수 있습니까? 열 5로 정렬하거나 열 5를 먼저 표시하려고합니까?

데이터 소스는 어떤 유형입니까?

상관없이 필터링은 코드 뒤에 있습니다.

여기보십시오 : http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.columns.aspx

(당신은 모든 열을 항상 포함하고도 싶지 않아 그냥 사람을 숨길 수 : Does anyone know of a way of hiding a column in an asp.net listview?)하는 데 도움이

희망을.

+0

안녕하세요 rjcup3, 내가 볼 수 있듯이 코드를 추가했습니다, 난 그냥 직접 드래그하고 도구 상자에서 "ListView"컨트롤을 떨어 뜨렸다. 원본을 "RssDataSource1"(실제로는 달력 용 RSS 임)으로 지정했습니다. 그래서 처음 5 일간의 이벤트를 표시하는 데 단지 5 개의 창 (열)을 갖기를 원합니다. 그런 다음 사용자가 날짜를 더 자세히보고 싶다면 다음을 눌러 미래의 이벤트를 볼 수 있습니다. 그래서 예. 나는 한 번에 5 점 만 봅니다. 하지만 기본적으로 ListView 내게 10 열을 제공합니다. – eastboundr

+0

다음을 클릭해도 데이터 소스가 다음 5를 표시하도록하려면 숨기기/숨김 처리가 가장 좋습니다. 그들이 다음을 클릭하면 첫 번째 5 개를 숨기고 두 번째 세트를 표시합니다. –

+0

rjcup3, 빠른 응답에 감사드립니다. 사실 19 개의 기록이 있습니다. 처음 10 개 레코드를 보여줍니다. 이후 페이징을 사용할 수있게되었습니다. 다음 (또는 2 페이지)을 클릭하면 다음 9 개의 레코드가 표시됩니다. 그래서 실제로 페이징을 사용하고 싶지만 페이지 당 10 개의 레코드 대신에 한 번에 5 개씩 갖고 싶습니다. 총 레코드 수는 달력의 RSS 피드이기 때문에 다를 수 있습니다. 따라서 하드 코드로 숨길 레코드 수를 지정할 수는 없습니다 ... 혼란스러워서. – eastboundr

관련 문제