Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Gridview inside ListView Control

Gridview inside ListView Control

Scheduled Pinned Locked Moved ASP.NET
helptutorial
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    megivimal
    wrote on last edited by
    #1

    Any one plz help me how to bind Gridview inside the Listview control

    S Z 2 Replies Last reply
    0
    • M megivimal

      Any one plz help me how to bind Gridview inside the Listview control

      S Offline
      S Offline
      sekannak
      wrote on last edited by
      #2

      Hi, U mean,inside Gridview, Listbox is a Itemtemplate... page_load() { u have to create the function as a dataset, within the function u have to take the id,text from the query. } DesingView: Then u have to call the function like, regards, kannak....

      kannak

      M 1 Reply Last reply
      0
      • S sekannak

        Hi, U mean,inside Gridview, Listbox is a Itemtemplate... page_load() { u have to create the function as a dataset, within the function u have to take the id,text from the query. } DesingView: Then u have to call the function like, regards, kannak....

        kannak

        M Offline
        M Offline
        megivimal
        wrote on last edited by
        #3

        Thanks, That's ok. If i bind the gridview to inside the listview control how it will work? It's like expand and collaspe button modal.

        1 Reply Last reply
        0
        • M megivimal

          Any one plz help me how to bind Gridview inside the Listview control

          Z Offline
          Z Offline
          Zafar A khan
          wrote on last edited by
          #4

          Insert a Grid View in item Template of ListView view below code The code is tested .

          <asp:ListView ID="ListView1" runat="server"
          onitemdatabound="ListView1_ItemDataBound1">
          <LayoutTemplate>
          <table border="0" cellpadding="3" cellspacing="0" width="97%">
          <tr class="lstheader">
          <td width="15%">
          Col one</td>
          <td width="15%">
          Grid Column</td>

                              </tr>
                              <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                          </table>
                      </LayoutTemplate>
                      <ItemTemplate>
                          <tr >
                              <td>
                                  <asp:Label ID="lblDate" runat="server" Text='<%#Bind("DepartmentID") %>'></asp:Label>
                              </td>
                              <td>
                                  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                                  <Columns>
                                  <asp:BoundField HeaderText="Department" DataField="Department" />
                                  </Columns>
                                  </asp:GridView>
                              </td>
                          </tr>
                      </ItemTemplate>
                      <AlternatingItemTemplate>
                          <tr >
                             <td>
                                  <asp:Label ID="lblDate" runat="server" Text='<%#Bind("DepartmentID") %>'></asp:Label>
                              </td>
                              <td>
                                  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                                  <Columns>
                                  <asp:BoundField HeaderText="Department" DataField="Department" />
                                  </Columns>
                                  </asp:GridView>
                              </td>
                          </tr>
                      </AlternatingItemTemplate>
                  </asp:ListView>
          

          now firstly Bind the ListView Control as below

          protected void Page_Load(object s

          M 1 Reply Last reply
          0
          • Z Zafar A khan

            Insert a Grid View in item Template of ListView view below code The code is tested .

            <asp:ListView ID="ListView1" runat="server"
            onitemdatabound="ListView1_ItemDataBound1">
            <LayoutTemplate>
            <table border="0" cellpadding="3" cellspacing="0" width="97%">
            <tr class="lstheader">
            <td width="15%">
            Col one</td>
            <td width="15%">
            Grid Column</td>

                                </tr>
                                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr >
                                <td>
                                    <asp:Label ID="lblDate" runat="server" Text='<%#Bind("DepartmentID") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                                    <Columns>
                                    <asp:BoundField HeaderText="Department" DataField="Department" />
                                    </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <AlternatingItemTemplate>
                            <tr >
                               <td>
                                    <asp:Label ID="lblDate" runat="server" Text='<%#Bind("DepartmentID") %>'></asp:Label>
                                </td>
                                <td>
                                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                                    <Columns>
                                    <asp:BoundField HeaderText="Department" DataField="Department" />
                                    </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </AlternatingItemTemplate>
                    </asp:ListView>
            

            now firstly Bind the ListView Control as below

            protected void Page_Load(object s

            M Offline
            M Offline
            megivimal
            wrote on last edited by
            #5

            It's working fine. Thanks. I need to expand and collapse the ID (Department-ID) the department details will be display in gridview or (listview). Plz help me.... Thanks.

            M Z 2 Replies Last reply
            0
            • M megivimal

              It's working fine. Thanks. I need to expand and collapse the ID (Department-ID) the department details will be display in gridview or (listview). Plz help me.... Thanks.

              M Offline
              M Offline
              megivimal
              wrote on last edited by
              #6

              Plz chk the below link. http://mattberseth.com/blog/2008/01/building_a_grouping_grid_with.html I need like this. Thanks.

              1 Reply Last reply
              0
              • M megivimal

                It's working fine. Thanks. I need to expand and collapse the ID (Department-ID) the department details will be display in gridview or (listview). Plz help me.... Thanks.

                Z Offline
                Z Offline
                Zafar A khan
                wrote on last edited by
                #7

                You Can Use "CollapsiblePanelExtender" inside Listview for expand and collapse Below code.

                <asp:ListView ID="ListView1" runat="server"
                onitemdatabound="ListView1_ItemDataBound1">
                <LayoutTemplate>
                <table border="0" cellpadding="3" cellspacing="0" width="97%">
                <tr >
                <td width="15%">
                Col one</td>
                <td width="15%">
                Grid Column</td>

                                    </tr>
                                    <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                                </table>
                            </LayoutTemplate>
                            <ItemTemplate>
                            <tr >
                            <td>
                                 <asp:Label ID="lblDepartmentID" runat="server" Text='<%# Bind("DepartmentID") %>'></asp:Label>
                            </td>
                            <td> 
                                    <asp:LinkButton CausesValidation="false" ID="lnkexp" runat="server">+</asp:LinkButton>
                                    <asp:LinkButton CausesValidation="false" ID="lnkCol" runat="server">-</asp:LinkButton>
                                    <asp:Label ID="Label3" runat="server" Text="panel"></asp:Label>
                                 <asp:Panel ID="pnl1" runat="server" >
                                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                                        <Columns>
                                        <asp:BoundField HeaderText="Department" DataField="Department" />
                                        </Columns>
                                        </asp:GridView>
                                </asp:Panel>
                                <cc1:CollapsiblePanelExtender ExpandControlID="lnkexp" CollapseControlID="lnkCol" TargetControlID="pnl1" ID="CollapsiblePanelExtender2" runat="server" TextLabelID="Label3" ExpandedText="collapse" CollapsedText="expand" SuppressPostBack="True" Collapsed="True">
                                </cc1:CollapsiblePanelExtender>
                                   
                                </td>
                               </tr>
                               
                            </ItemTemplate>
                            <AlternatingItemTemplate>
                                 <tr >
                            <td>
                
                M 1 Reply Last reply
                0
                • Z Zafar A khan

                  You Can Use "CollapsiblePanelExtender" inside Listview for expand and collapse Below code.

                  <asp:ListView ID="ListView1" runat="server"
                  onitemdatabound="ListView1_ItemDataBound1">
                  <LayoutTemplate>
                  <table border="0" cellpadding="3" cellspacing="0" width="97%">
                  <tr >
                  <td width="15%">
                  Col one</td>
                  <td width="15%">
                  Grid Column</td>

                                      </tr>
                                      <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                                  </table>
                              </LayoutTemplate>
                              <ItemTemplate>
                              <tr >
                              <td>
                                   <asp:Label ID="lblDepartmentID" runat="server" Text='<%# Bind("DepartmentID") %>'></asp:Label>
                              </td>
                              <td> 
                                      <asp:LinkButton CausesValidation="false" ID="lnkexp" runat="server">+</asp:LinkButton>
                                      <asp:LinkButton CausesValidation="false" ID="lnkCol" runat="server">-</asp:LinkButton>
                                      <asp:Label ID="Label3" runat="server" Text="panel"></asp:Label>
                                   <asp:Panel ID="pnl1" runat="server" >
                                          <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                                          <Columns>
                                          <asp:BoundField HeaderText="Department" DataField="Department" />
                                          </Columns>
                                          </asp:GridView>
                                  </asp:Panel>
                                  <cc1:CollapsiblePanelExtender ExpandControlID="lnkexp" CollapseControlID="lnkCol" TargetControlID="pnl1" ID="CollapsiblePanelExtender2" runat="server" TextLabelID="Label3" ExpandedText="collapse" CollapsedText="expand" SuppressPostBack="True" Collapsed="True">
                                  </cc1:CollapsiblePanelExtender>
                                     
                                  </td>
                                 </tr>
                                 
                              </ItemTemplate>
                              <AlternatingItemTemplate>
                                   <tr >
                              <td>
                  
                  M Offline
                  M Offline
                  megivimal
                  wrote on last edited by
                  #8

                  Thanks Zafar. It's working fine. Thanks a lotttt.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups