This is a migrated thread and some comments may be shown as answers.

listview insid listview

4 Answers 55 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Med
Top achievements
Rank 1
Med asked on 21 May 2012, 10:30 PM
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 :)

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 May 2012, 06:15 AM
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.
0
Berrabah
Top achievements
Rank 1
answered on 25 May 2012, 08:00 PM
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 ?
0
Shinu
Top achievements
Rank 2
answered on 28 May 2012, 10:57 AM
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.
0
Berrabah
Top achievements
Rank 1
answered on 04 Jun 2012, 06:15 AM
Hi  Shinu,
Can you please give me an example that exmplain that cause I can't  made it :( 
Thank you

Tags
ListView
Asked by
Med
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Berrabah
Top achievements
Rank 1
Share this question
or