0
Reply

child listviw issue

Tauseef Khan

Tauseef Khan

Nov 18 2009 6:06 PM
2.4k
hi guys

i am working on parent child list view , in which i am showing a child list view
which is shown upon click on linkbutton in parent listview ,
but listview is not visible at runtime upon clickink link button , got attaches
the objectdatasource at runtime no exception but child list view is not shown , please help.
child listview is hidden its shown upon orderclick labelbutton in parent listview,
there is just a bar shown upon button click but not proper listview .



<body>
      <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
      <div>
      <p>
      <strong>Select Customer</strong>
      <asp:DropDownList ID ="dpcustomers" runat ="server"
                  DataSourceID="customerdatasource" Width ="150px" AutoPostBack="True"
               ></asp:DropDownList>
            <asp:Label ID="lblp" runat="server" Text="." Visible="False"></asp:Label>
            </p>
        
            <asp:ObjectDataSource ID="customerdatasource" runat="server"
                  SelectMethod="GetAllCustomers" TypeName="BAL.CustomerBAL">
            </asp:ObjectDataSource>
      </div>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
     
      <ContentTemplate>
     
      <asp:ListView ID   = "lstview" runat ="server" SkinID ="3"
                  DataSourceID="orderdatasource" onitemcommand="lstview_ItemCommand"
                  >
  
      <LayoutTemplate>
     
      <table id ="itemplaceholdercontainer" runat = "server"   cellpadding ="6">
      <tr runat = "server" >
      <th style = " background :white">
      </th>
      <th>
      Order ID
      </th>
      <th>
      Customer ID
      </th>
      <th>
      Order Date
      </th>
      <th>
      Ship Address
      </th>
      <th>
      Ship Country
      </th>
      <th>
      Orders
      </th>
      </tr>
      <tr runat ="server" id ="itemPlaceholder"></tr>
      <tr>
      <td>
      <asp:LinkButton ID = "addnewlink" runat ="server" Text = "Add New"></asp:LinkButton>
      </td>
      </tr>
      </table>
     
      </LayoutTemplate>
     
      <ItemTemplate >
      <tr>
      <td>
         <asp:LinkButton ID="EditButton" CommandName="Edit" runat="server" Text="Edit"></asp:LinkButton>
         <asp:LinkButton ID="DeleteButton"   OnClientClick="return confirm('Delete Record?');" CommandName="Delete" CommandArgument='<%# Eval("CustomerID")%>' runat="server" Text="Delete"></asp:LinkButton>
      </td>
      <td>
      <asp:Label ID   = "lblorderid" runat ="server" text = '<%#Eval("orderid")%>'></asp:Label>
      </td>
      <td>
      <asp:Label ID   = "lblcustomerid" runat ="server" text = '<%#Eval("customerid")%>'></asp:Label>
      </td>
      <td>
      <asp:Label ID   = "orderdate" runat ="server" text = '<%#Eval("orderdate")%>'></asp:Label>
      </td>
      <td>
      <asp:Label ID   = "shipaddress" runat ="server" text = '<%#Eval("shipaddress")%>'></asp:Label>
      </td>
      <td>
      <asp:Label ID   = "shipcountry" runat ="server" text = '<%#Eval("shipcountry")%>'></asp:Label>
      <td>
      <asp:LinkButton ID="lbOrders" runat="server" Text="Orders"   CommandName ="order" CommandArgument='<%#Eval("orderid") %>' />
      </td>
      </td>
      </tr>
      <%--Order List View--%>
      <tr   visible ="false"   runat ="server" id = "roworders" style =" background :lightgrey">
   <td colspan ="7">
      <asp:ListView ID = "lvorders" runat ="server">
      <LayoutTemplate >
      <table runat ="server" id = "tbllstview">
      <tr>
      <th>
      Order ID
      </th>
      <th>
      Product ID
      </th>
         <th>
      Unit Price
      </th>
      <th>
Quantity
      </th>
      <th>
Discount
      </th>
      </tr>
<tr runat ="server" id ="itemPlaceholder"></tr>
      <tr>
      <td>
      <asp:LinkButton ID = "orderaddnewlink" runat ="server" Text = "Add New"></asp:LinkButton>
      </td>
      </tr>
     
      </table>
     
      </LayoutTemplate>
      <ItemTemplate >
      <tr>
      <td>
      <asp:Label ID   = "lblorderid" runat ="server" text = '<%#Eval("orderid")%>'></asp:Label>
     
      </td>
     
      <td>
      <asp:Label ID   = "Lblproductid" runat ="server" text = '<%#Eval("productid")%>'></asp:Label>
     
      </td>
     
      <td>
      <asp:Label ID   = "unitprice" runat ="server" text = '<%#Eval("productid")%>'></asp:Label>
     
      </td>
     
      <td>
      <asp:Label ID   = "Lblquantity" runat ="server" text = '<%#Eval("quantity")%>'></asp:Label>
     
      </td>
      </tr>
     
     
      </ItemTemplate>
      </asp:ListView>
      </td>
     
      </tr>
     
      </ItemTemplate>
     
      </asp:ListView>
            <asp:ObjectDataSource ID="orderdatasource" runat="server"
                  SelectMethod="GetOrdersByCustomer" TypeName="BAL.CustomerBAL">
                  <SelectParameters>
                        <asp:ControlParameter ControlID="dpcustomers" Name="customer"
                              PropertyName="SelectedValue" Type="String" />
                  </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
                  SelectMethod="GetOrdersByCustomer" TypeName="BAL.CustomerBAL">
                  <SelectParameters>
                        <asp:ControlParameter ControlID="lblp" Name="customer" PropertyName="Text"
                              Type="String" />
                  </SelectParameters>
            </asp:ObjectDataSource>
      </ContentTemplate>
            <Triggers>
                  <asp:AsyncPostBackTrigger ControlID="dpcustomers"
                        EventName="SelectedIndexChanged" />
            </Triggers>
     
      </asp:UpdatePanel>
      </form>
</body>