listview insid listview

5 posts, 0 answers
  1. Med
    Med avatar
    1 posts
    Member since:
    Mar 2012

    Posted 21 May 2012 Link to this post

    Hi every body,
    Can any body tell me please how can I do to display a listview insid an other listview with 2 sqldatasource !?
    Thank you so mutch :)
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 May 2012 Link to this post

    Hi,

    Try the following code to achieve your scenario.
    aspx:
    <telerik:RadListView ID="RadListView1" ItemPlaceholderID="EmployeesContainer" DataSourceID="SqlDataSource1"runat="server">
      <LayoutTemplate>
        <fieldset>
           <legend>Employees</legend>
            <asp:PlaceHolder ID="EmployeesContainer" runat="server" />
        </fieldset>
      </LayoutTemplate>
       <ItemTemplate>
         <telerik:RadListView ID="RadListView1"  ItemPlaceholderID="EmployeesContainer" DataSourceID="SqlDataSource2" runat="server">
           <LayoutTemplate>
              <fieldset><legend>Employees</legend>
                <asp:PlaceHolder ID="EmployeesContainer" runat="server" />
               </fieldset>
           </LayoutTemplate>
        </telerik:RadListView>
      </ItemTemplate>
    </telerik:RadListView>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Berrabah
    Berrabah avatar
    37 posts
    Member since:
    Feb 2012

    Posted 25 May 2012 Link to this post

    Hi Shinu and thankx for your poste,

    I have did just like your code but it's doesn't work :

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="ContactesListeView.aspx.vb" Inherits="Pages_ContactesListeView" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            </telerik:RadScriptManager>
             <telerik:RadListView ID="RadListView1" ItemPlaceholderID="EmployeesContainer" runat="server" DataKeyNames="Id" 
                DataSourceID="SqlDataSource1">
                <LayoutTemplate>
              <fieldset>
           <legend>Employees</legend>
            <asp:PlaceHolder ID="EmployeesContainer" runat="server" />
        </fieldset>
      </LayoutTemplate>
      <ItemTemplate>
          <telerik:RadListView ID="RadListView2" runat="server" ItemPlaceholderID="EmployeesContainer" DataSourceID="SqlDataSource2" >
          <LayoutTemplate>
              <fieldset><legend>Employees</legend>
                <asp:PlaceHolder ID="EmployeesContainer" runat="server" />
               </fieldset>
           </LayoutTemplate>
          </telerik:RadListView>
      </ItemTemplate> 
            </telerik:RadListView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ObservatoireConnectionString %>" 
                DeleteCommand="DELETE FROM [ActeurContributeur] WHERE [Id] = @Id" 
                InsertCommand="INSERT INTO [ActeurContributeur] ([Nom], [Adresse1], [Adresse2], [CodePostale], [Ville], [Email], [TelFixe], [Fax], [Logo], [SiteWeb]) VALUES (@Nom, @Adresse1, @Adresse2, @CodePostale, @Ville, @Email, @TelFixe, @Fax, @Logo, @SiteWeb)" 
                SelectCommand="SELECT * FROM [ActeurContributeur]" 
                
                UpdateCommand="UPDATE [ActeurContributeur] SET [Nom] = @Nom, [Adresse1] = @Adresse1, [Adresse2] = @Adresse2, [CodePostale] = @CodePostale, [Ville] = @Ville, [Email] = @Email, [TelFixe] = @TelFixe, [Fax] = @Fax, [Logo] = @Logo, [SiteWeb] = @SiteWeb WHERE [Id] = @Id">
                <DeleteParameters>
                    <asp:Parameter Name="Id" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Nom" Type="String" />
                    <asp:Parameter Name="Adresse1" Type="String" />
                    <asp:Parameter Name="Adresse2" Type="String" />
                    <asp:Parameter Name="CodePostale" Type="String" />
                    <asp:Parameter Name="Ville" Type="String" />
                    <asp:Parameter Name="Email" Type="String" />
                    <asp:Parameter Name="TelFixe" Type="String" />
                    <asp:Parameter Name="Fax" Type="String" />
                    <asp:Parameter Name="Logo" Type="Object" />
                    <asp:Parameter Name="SiteWeb" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Nom" Type="String" />
                    <asp:Parameter Name="Adresse1" Type="String" />
                    <asp:Parameter Name="Adresse2" Type="String" />
                    <asp:Parameter Name="CodePostale" Type="String" />
                    <asp:Parameter Name="Ville" Type="String" />
                    <asp:Parameter Name="Email" Type="String" />
                    <asp:Parameter Name="TelFixe" Type="String" />
                    <asp:Parameter Name="Fax" Type="String" />
                    <asp:Parameter Name="Logo" Type="Object" />
                    <asp:Parameter Name="SiteWeb" Type="String" />
                    <asp:Parameter Name="Id" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>


        <asp:sqldatasource ID="Sqldatasource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ObservatoireConnectionString %>" 
        DeleteCommand="DELETE FROM [ActeurContact] WHERE [Id] = @Id" 
        InsertCommand="INSERT INTO [ActeurContact] ([ContributeurId], [CiviliteId], [Nom], [Prenom], [Adresse1], [Adresse2], [CodePostale], [Ville], [Photo], [TelMobile], [TelFix], [Fax], [Fonction], [Ordre]) VALUES (@ContributeurId, @CiviliteId, @Nom, @Prenom, @Adresse1, @Adresse2, @CodePostale, @Ville, @Photo, @TelMobile, @TelFix, @Fax, @Fonction, @Ordre)" 
        SelectCommand="SELECT * FROM [ActeurContact]" 
        UpdateCommand="UPDATE [ActeurContact] SET [ContributeurId] = @ContributeurId, [CiviliteId] = @CiviliteId, [Nom] = @Nom, [Prenom] = @Prenom, [Adresse1] = @Adresse1, [Adresse2] = @Adresse2, [CodePostale] = @CodePostale, [Ville] = @Ville, [Photo] = @Photo, [TelMobile] = @TelMobile, [TelFix] = @TelFix, [Fax] = @Fax, [Fonction] = @Fonction, [Ordre] = @Ordre WHERE [Id] = @Id">
        <DeleteParameters>
            <asp:Parameter Name="Id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="ContributeurId" Type="Int32" />
            <asp:Parameter Name="CiviliteId" Type="Int32" />
            <asp:Parameter Name="Nom" Type="String" />
            <asp:Parameter Name="Prenom" Type="String" />
            <asp:Parameter Name="Adresse1" Type="String" />
            <asp:Parameter Name="Adresse2" Type="String" />
            <asp:Parameter Name="CodePostale" Type="String" />
            <asp:Parameter Name="Ville" Type="String" />
            <asp:Parameter Name="Photo" Type="Object" />
            <asp:Parameter Name="TelMobile" Type="String" />
            <asp:Parameter Name="TelFix" Type="String" />
            <asp:Parameter Name="Fax" Type="String" />
            <asp:Parameter Name="Fonction" Type="String" />
            <asp:Parameter Name="Ordre" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="ContributeurId" Type="Int32" />
            <asp:Parameter Name="CiviliteId" Type="Int32" />
            <asp:Parameter Name="Nom" Type="String" />
            <asp:Parameter Name="Prenom" Type="String" />
            <asp:Parameter Name="Adresse1" Type="String" />
            <asp:Parameter Name="Adresse2" Type="String" />
            <asp:Parameter Name="CodePostale" Type="String" />
            <asp:Parameter Name="Ville" Type="String" />
            <asp:Parameter Name="Photo" Type="Object" />
            <asp:Parameter Name="TelMobile" Type="String" />
            <asp:Parameter Name="TelFix" Type="String" />
            <asp:Parameter Name="Fax" Type="String" />
            <asp:Parameter Name="Fonction" Type="String" />
            <asp:Parameter Name="Ordre" Type="Int32" />
            <asp:Parameter Name="Id" Type="Int32" />
        </UpdateParameters>
    </asp:sqldatasource>

        </div>
        </form>
        
    </body>
    </html>

    So what should I do ?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 May 2012 Link to this post

    Hi,

    From your code I cannot find any data binding method for the inner ListView. Here is the sample code that I tried which worked as expected.
    aspx:
    <telerik:RadListView ID="RadListView1"  ItemPlaceholderID="EmployeesContainer" DataSourceID="SqlDataSource2"runat="server">
     <LayoutTemplate>
       <table>
           <tr>
             <asp:Label ID="CustomerIDLabel" runat="server" Text='<%# Eval("Address1") %>' />
            </tr>
       </table>
     <asp:PlaceHolder ID="EmployeesContainer" runat="server" />
     </LayoutTemplate>
    </telerik:RadListView>

    Thanks,
    Shinu.
  6. Berrabah
    Berrabah avatar
    37 posts
    Member since:
    Feb 2012

    Posted 04 Jun 2012 Link to this post

    Hi  Shinu,
    Can you please give me an example that exmplain that cause I can't  made it :( 
    Thank you

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017