Web Forms :: Implement Nested ListView
Feb 25, 2013I want to know if you can make a listview to another inner listview with c # asp.net as this example of gridview: URL....
View 1 RepliesI want to know if you can make a listview to another inner listview with c # asp.net as this example of gridview: URL....
View 1 RepliesI have anested ListView control. I also implemented a jQuery to automatically expand the TextBox control inside of the nested ListView Insert Template. The problem is, when the Textbox expand, the outer ListView control is not; therefore, the Textbox control expands underneath the buttons of the outer listView control. How do I expand the outer ListView control as the nested ListView textbox is automatically expand? One great example is in Facebook where if I add a response comment, it'll automatically push any comments below mine down. If nested Listview control is not the best way to do this, what are my options?
View 8 RepliesI am having trouble finding how to solve the following issue :
I am using nested listviews to display Sales and Sales details.
The main ListView displays General Information about Sales and the child ListView displays the detailed information about one sale. the child listview is shown only when the user clicks on a link (see included code, DataBind is made on PageLoad) :
ASPX Markup Code :
[Code]....
C# Behind Code :
[Code]....
If I removed the datapager part, I can manage show/hide the child list view on the button click event. but if I want to use the DataPager with the PreRender event handling, the child listview is not longer shown on button click.
Ok, background first:
The form allows a user to create and edit one estimate.
Each estimate can contain multiple Jobs, which are represented in a ListView.
Each Job can contain multiple Parts, which are contained in a ListView that sits in each item of the Jobs ListView.
A user can add and remove as many Jobs as they want.
A user can add and remove as many Parts to/from each Job as they want.
I have no issues adding to each of these, but I do have a problem removing a single part from a single job.
For a reference, here is one Job in the Jobs ListView on the form:
I want to make sure that no matter what a user does, the part of the form they are working on saves what they have. Removing a row from that Parts ListView is no exception. What I want it to do is save the values in each of those textboxes and then delete the necessary row.
Here's what I have in the codebehind:
[Code]....
The EstimateRow variable I create does not get a value from theListView)HFERID.Parent.FindControl("LVEstimateRow") bit of code. There must be another level of nesting that I'm not accessing correctly, because it can't seem to find that nested ListView.
i need to get data-bound items from outer listview to display in inner Listview, in this scenario:
[code]....
Where the higlighted text mean the title for outer datasource.
I am trying to implement a nested user control in listview and the user control doesn't get bound.
Here is my code.
[Code]....
I'm try to create a nested listview with the following display:
Category 1
--Board 1
--Board 2
Category 2
--Board 1
--Board 2
--Board 3
Here is my code so far:
[Code]....
The Data is from a SQL Data Source:
[Code]....
However I'm not sure what to set the inner listview's DataSourceID to as I need to display just the boards in that category.
I am trying to get my Nested ListView to work. I have my parent List View supplying the correct information, but I can't seem to set the SelectParameter Value for my Nested ListView. I am using SQLDataSources for both. I read your comment about adding a Hidden Field. Where Should that field be located. Right now I have it inside my Parent ItemTemplate but nothing is happening. Currently I have both DataSource outside my Parent ListView. I tried moved the nested ds inside with the list view but I still was not able to grab the hidden field values either. Here's what I have:
<asp:ListView
ID="lv"
runat="server"
DataSourceID="sdsParent"
DataKeyNames="CaseNo">
<LayoutTemplate>
<div
class="grid">
<h2>Bankruptcies
by RetailerID <asp:ImageButton
ID="btnSort"
runat="server"
ImageUrl="images/sort_asc.gif"
ImageAlign="AbsMiddle"
CommandName="Sort"/></h2>
<table
id="tblBankruptcy"
cellpadding="0"
cellspacing="0">
<tr
class="head">
<th
class="first"></th>
<th>Retailer
ID</th>
<th>Retailer
Name</th>
<th>Chapter
Number</th>
<th>District</th>
<%
--<th>Date</th>--%></tr>
<tr
id="itemPlaceholder"
runat="server"
/>
</table>
<table
id="pager"
cellpadding="0"
cellspacing="0">
<tr
class="pager">
<asp:DataPager
ID="pager"
runat="server"
PageSize="8">
<Fields>
<asp:TemplatePagerField
OnPagerCommand="PagerCommand">
<PagerTemplate>
<td
class="commands">
<asp:ImageButton
ID="btnFirst"
runat="server"
CommandName="First"
ImageUrl="images/first.gif"
AlternateText="First Page"
ToolTip="First Page"
/>
<asp:ImageButton
ID="btnPrevious"
runat="server"
CommandName="Previous"
ImageUrl="images/prev.gif"
AlternateText="Previous Page"
ToolTip="Previous Page"
/>
<asp:ImageButton
ID="btnNext"
runat="server"
CommandName="Next"
ImageUrl="images/next.gif"
AlternateText="Next Page"
ToolTip="Next Page"
/>
<asp:ImageButton
ID="btnLast"
runat="server"
CommandName="Last"
ImageUrl="images/last.gif"
AlternateText="Last Page"
ToolTip="Last Page"
/>
</td>
<td
class="info">
Page
<b>
<%
# Container.TotalRowCount > 0 ?
Math.Ceiling(((double)(Container.StartRowIndex + Container.MaximumRows)
/ Container.MaximumRows)) : 0 %></b>
of
<b>
<%
#
Math.Ceiling((double)Container.TotalRowCount / Container.MaximumRows)%></b>
(<%
# Container.TotalRowCount %> items)
</td>
</PagerTemplate>
</asp:TemplatePagerField>
</Fields>
</asp:DataPager>
</tr>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<%
<%
-- <table id="orders" cellpadding="0" cellspacing="0">--%><tr
id="itemPlaceholder"
runat="server"
/>
-- </table>--%><tr
id="row"
runat="server"
class="group">
<th
class="first">
<img
src="images/plus.png"
alt='Group:
<%# Eval("CaseNo")%>'
onclick="toggleGroup(this, '<%# Eval("RetailerId") %>');"
/>
</th>
<th
colspan="1">
<%
# Eval("RetailerId")%>
</th>
<th>
<%
# Eval("RetailerName")%></th>
<th>
<%
# Eval("BankruptcyTypeID")%>Chaper 11</th>
<th>
<%
# Eval("DistrictID")%>District</th>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<asp:ListView
ID="lvItems"
runat="server"
DataSourceID="sdsChild">
<LayoutTemplate>
<tr
runat="server"
id="itemPlaceholder"
/>
</LayoutTemplate>
<ItemTemplate>
<tr
class="item">
<th></th>
<th>Action</th>
<th>Comments</th>
<th>Attorney
Information</th>
<th>Date</th>
</tr>
<tr
id="row"
runat="server"
class="item">
<td
class="first"></td>
<td><%#
Eval("ActionID")%></td>
<td><%#
Eval("CaseNo")%></td>
<td><%#
Eval("Comments")%></td>
<td><%#
Eval("AssigneId") %></td>
<td><%#
Eval("Date",
"{0:MM/dd/yyyy}")%></td>
<td><%#
Eval("CaseNo") %></td>
</tr>
</ItemTemplate>
</asp:ListView>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource
ID="sdsParent"
runat="server"
ConnectionString="<%$ ConnectionStrings:Legal %>"
SelectCommand="SELECT * FROM [tblBankruptcy ]">
</asp:SqlDataSource>
<asp:SqlDataSource
ID="sdsChild"
runat="server"
ConnectionString="<%$ ConnectionStrings:Legal %>"
SelectCommand="select * from tblbankruptcyaction where CaseNo = @CaseNo">
<SelectParameters>
<asp:ControlParameter
ControlID="hf1"
Name="CaseNo"/>
</SelectParameters>
</asp:SqlDataSource>
I have two listviews. What i want to do is that when the nested listview emptydatatemplate shows i want to put a hyperlink with a querystring in it, the id in the querystring should be the fk in the nested listview. Is it possible to bind the hyperlink with the id in codebehind? I use two object datasources. Does it matter where i put the nested listview now i have it in the parents itemtemplate. Also it seems to be a problem to set the datakeynames in the nested listview, what could be the reaso for that.
[Code]....
I have a nested listview that I want to select the DataItem with a LinkButton or firing the ListViewSelectEventArgs, but I can't. I try the LinkButton with the sender object but a get null for the LinkButton when the OnClick event is fire and also try the ListViewSelectEventArgs to get the DataItem and again a get null for the object.
[Code]....
I'm trying the following code to access the value of a ListBox nested in a ListView.
View 3 Replies have a nested listviews:
Listview1-Item1
<if Listview1.selected index = 0>
Item1NestedListView - item1
Item1NestedListView - item2
When a user selects an item in the parent listview, the nested listiview displays as part of the selected item template - when a user selects an item in a nested listview it correctly populates a third, separate listview. To make sure I'm being clear, I have a parent listview with many rows and each of those rows has a nested listview, that is only populated and displayed when the row is selected. The parameters for the nested listview are set in the ItemDatabound event of the parent.
I had this working fine when both objectdatasources were on the aspx page. However, requirements have changed and we would like to pass a class to the BLL. I cannot figure out how to do this using a datasource on the aspx page. I can pass a class doing a databind in the code behind. However, if I do the databind in the code behind, the SelectedItem template does not get displayed as I would like. I need to find the the selectedIndex for the parent listview in SelectedIndexChanging. however, when I click or 'select' an item in the parent listview, the page refreshes, the ItemDatabound of the parent of the parent fires NOT knowing the selectedindex, then the SelectedIndexChanging event fires changing the SelectedIndex. By this time the Listview is already on the screen without the selectedItemTemplate containing the nested listview. If I click on another item, the when the page refreshes it knows the selectedItemIndex chosen before and displays that SelectedItemTemplate containing the selected index.
what i want to apply paging on each list view "lvProducts" with in repeater "rptBrands";
in other words ;
i have several Brands and each one of them contains some products;
so i want to apply paging on each products group within their brand
so if you check the code below you find that it apply paging in good manner;
the problem is that if i select page 2 on the second brand group it will display page 2 for brand 2 and all brands group which is not needed ;
so how can i apply paging??
<div id="HomeContainer">
<asp:Repeater runat="server" ID="rptBrands" >
<ItemTemplate>
<asp:HiddenField ID="hfBrandId" runat="server" Value='<%#Eval("BrandId") %>' />
<div>
[Code]....
I have two listviews. The inner listview (InnerListView1) is in the SelecttItemTemplate of the outer listview (OuterListView1). Both listviews are bind in the code behind. The outer listview displays correctly in the ItemTemplate. Neither Listview Listview displays in the SelectItemTemplate. Both should display when I click the Select button. I just get a postback (flicker). The display should include the selected record of the outer listview and the inner listview.
Shown be low are code snipets of the.
Markup:
<asp:ListView ID="OuterListView1" DataKeyNames="entryid" runat="server" EnableViewState="False" EnableModelValidation="True" InsertItemPosition="LastItem" OnItemDataBound="OuterListView1_ItemDataBound" OnSelectedIndexChanging="OuterListView1_OnSelectedIndexChanging"
>
[Code]....
I am trying to export a Nested Listview to Excel, but I am having issues with the code recognizing the records in the ListView. When I do a FindControl, that code works fine.The Issue arises when I try to loop through the Items of the Nested Listview. The Count always comes back as 0 (zero). However, if I do a watch on the nested listview variable and navigate to the Items collection, then the count is updated with the correct content. I've tried forcing a Databind() on the 2nd Listview, but that really shouldn't be necessary as I know the records are there. As a result, I am having issues Exporting the Data to Excel since only data from the Parent ListView is returned.
[Code]....
I am having a problem with finding the innermost ListView of a triple nested ListView. The middle ListView has a LinkButton whose event is handled by the outermost's ItemCommand. In the ItemCommand I want to find the third, innermost ListView and set its datasource. How can I find it?
View 7 RepliesI have a list box in a list view control. I want to access the value of the listbox. I have fixed the height of the list box and the box has scroll bars. If i change the number using the scrollbar and then click on the number (turning it blue) everthing works fine. If I simply change the number using the scrollbar the system throws the error below. Can anyone tell me how to get this to work simply by using the scrollbar to select the number (without having to also click on the number itself) This is the error that is thrown
[FormatException: ??????????????????]
Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
+201
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +66
[InvalidCastException: String "" ??? 'Integer' ??????????]
This is the aspx listbox
<td><asp:label id="Label1" runat="server" text='<%# eval("CustomerID") %>'></asp:label></td>
<td><asp:label id="label2" runat="server" text='<%# eval("ProductID") %>'></asp:label></td>
<td>
<asp:ListBox ID="ListBox1" runat="server" Height="30px">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:ListBox>
</td>
<td>$<asp:label id="label4" runat="server" text='<%# eval("OrderDate") %>'></asp:label></td>
<td>
<asp:Button ID="Button1" runat="server" Text="order" CommandName="cart"
CommandArgument='<%# eval("CustomerID")%>'/></td>
This is the vb page
Partial Class Droplist
Inherits System.Web.UI.Page
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim db As New DataClassesDataContext
ListView1.DataSource = db.Droplist1
ListView1.DataBind()
End If
End Sub
Sub upload(ByVal sender As Object, ByVal e As ListViewCommandEventArgs)
If e.CommandName = "cart" Then
Dim q As ListBox = e.Item.FindControl("Listbox1")
Dim ProductNumber As Integer = CType(q.SelectedValue, Integer)
Label3.Text = ProductNumber
End If
End Sub
End Class
in the nested ListView (or the child ListView), the edit command does not work.
It seems that the <EditItemTemplate> is not properly excecuted by the edit button in the <ItemTemplate>.
Interestingly, the edit command in the parent ListView works well.
The insert and delete commands in the nested ListView also run without any problem.
But I get no change by pushing the edit button which is located for each reply (the item of the nested listview)
Here is my code.
[code]...
I have a RadioButtonList control inside of a nested ListView control InsertTemplate. I need a way to access this control in the nestedListView_ItemInserting method.
View 6 RepliesI have a listbox in a list view control. I want to acces the values.
This is the aspx page
//this is aspx code.
<asp:ListView ID="ListView1" runat="server" >
<Layouttemplate>
<placeholder runat="server" id="itemplaceholder">
</placeholder>
[Code].....
How can i implement Custom Paging for ListView control using row_number in sql server 2005 stored procedure.
View 2 RepliesI have two nested DropDownLists (the value selected in the 1st ddl will limit the content of the 2nd ddl).
The example attached here runs fine outside of a GridView. As soon as I try to insert this into a GridView, I get an error because I cannot identify the ControlID to use in the ControlParameter.
The code outside of the GridView looks like this:
<asp:DropDownList ID="ACTION1_DROPDOWNLIST"
AutoPostBack="true" ToolTip="Dropdown List" runat="server" CssClass="Select"
DataSourceID="SqlDataSource1" DataTextField="Description" DataValueField="ID" >
[Code].....
I have triple-nested ListView controls on my asp.net page, each nested within another. I use the OnItemDataBound event in the 1st ListView to set the DataSource of the 2nd level ListView. The 3rd ListView is contained in the of the 2nd ListView. I want to assign the same DataSource to both the 2nd and 3rd level ListView datasource controls, but I cannot figure out how to access the 3rd level ListView in order to do that.
[Code]....
The level1_ItemDataBound method finds the level2 control, casts it as a ListView, sets its DataSource and executes the DataBind. At this point I'm stuck trying to get Level3.DataSource to be set to the same as Level2.DataSource.
i want to implement this feature in listview control which is bound to objectdatasource... and in on mouse over i have to show the data from database again. when you mouse over the linkbutton then div popup with contents...how to imlement with listview.
link for the feature is
[URL]
I have an array object with another nested arrayobject within it. I am binding the outer arrayobject to a gridview and on row data bound event i am refernecing the nested array object and populating a dropdown list in atemplate column of a gridview row. Thgis works fine but when i implement paging and handle the PageChanging event then the data binding of the nested array does not complete properly. See code below. For each page in the gridview the dropdown list is repeatedly populated with the same data
View 6 Replies