.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

AccessDataSource and Listview control question

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :ASP.Net


Let me try to explain what I want to do:

I want to display an post using a Listview control connected to a AccessDataSource, and I display one post at a time.

But each post has comments, so I want to display the comments of each post on the bottom of the page using other Listview control.

I'm not sure how to do this... do I need a new AccessDataSource control to get the comments, if that's so, how do I synchronize  the two AccessDataSource's so they use the same post ID ... or am I doing this wrong?

Any idea ? Undecided


View Complete Post

More Related Resource Links

Accessing Label Control In a listview using Javascript



I have a Button and Label nested inside a ListView.

When a User clicks the button i want the Label to display a specific value eg"Pass". Of course being a Listview the Label value will be relevant to the row the button was clicked on.

I want all this to happen on client side, but i am struggling to access the Label via my Javascript??

Any suggestions and examples Would be much appreciated..

output cache to be used only when parameter has changed + old question of user control not answered



i have 2 questions about output cache:

1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.

2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?

3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :


and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.

can anyone please help me?

Printer Friendly Page from a listview control


Hi guys,

I am working on a web form that displays the data from an access data source into a list view control. I need an advice on how to create , render a new page printer freindly .not buttons, controls,,, I have implemented a  java script function to select which records I want to view in the printable page but I cannot came up with any idea on how  to use this to create the printable help..


A layout, mouse selection, ListView problem/question

I'm having a problem with a particular layout scenario, and how it interacts with a left mouse click in certain situations. I have 3 rows in a Grid.  The first is a ListView (Master), with the Row Height set to '*'. It's ItemSource is bound to a collection in a ViewModel, and its SelectedItem is bound to a value in the ViewModel.  When the SelectedItem is null, it should take up its entire container (the other 2 rows are invisible). The second row is the GridSplitter.  It's visibility is bound to a value in the ViewModel.  It's only visible when the SelectedItem in the Master ListView is not null.  It's GridRow height is set to Auto, and it's height is explicitly set to 5 (via a style). The third row is a sub-ListView that shows Detail data for the Master SelectedItem in the top ListView.  It's GridRow Height is set to zero by default, and if an item is selected in the Master ListView, it should become visible and have a set height (400 to start, via a binding on the Height of the row). The desired effect is that when an item is selected in the Master ListView, the Detail ListView becomes visible and the GridSplitter allows you to resize the top and bottom as needed.  If necessary, the ScrollBars become visible in the Master ListView to show any items that are now obscured by the Detail ListView (via the automatic scrolling featur

How to Delete from a SortedList using Listview Control

I'm new to Asp.net, and I looked at an example of using a listbox's selected index to delete from a sortedlist. I'd like to write something that would get the selected index from a different control, like a listview, and then delete from the sortedlist. I've read up on a few examples on how to bind data from a sortedlist to a listview, but I've not seen an example of how to get the index once the data is displayed! Can this be done? Thanks for any response!

Microsoft ListView Control 6.0 cannot correctly display multibyte characters when running on a 64 bi

With all the regional settings set to Russian and the OS being Russion the ListView Control 6.0 does not display the column headers correctly on the Windows Server 2008 64 bit OS. If we switch to using Microsoft ListView Control, version 5 the columns (text strings) are displayed correctly. I am concerned that using an earlier version is going to cause problems. Is there a better solution other than using version 5? Thanks!

Passing Id to a querystring in a Listview Control

I have tried almost evrything and nothing seems to work,,, I dont see errors but the code is not firing when I bind in the properties of the button control ,,nor the code behind., much help is appreciated,,aspx<LayoutTemplate>                <table id="Table1"cellpadding="0" cellspacing="0" style="border-right: #000000 thin solid; border-top: #000000 thin solid;                                    border-left: #000000 thin solid; border-bottom: #000000 thin solid; background-color: #FFFFFF; border-width: 1px;"                                    width="100%" align="center">        <tr>            <td>                    <b>Matching Providers </b>        

Find Control in ListView ItemTemplate

I want to pass the checked checkboxes value of my listview control to a second page so I can display the listview in this second page  with only those selected recordsthis is what I am have so far , but dont really know how to get it to work the desire way.. Code is working but I am afraid that chekcbox and listview values for my loop are not correctMuch help is appreciated!! page1 codeProtected Sub ListView1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ListView1.ItemDataBound        Dim recordsId As New List(Of String)        Dim chb As CheckBox = DirectCast(ListView1.FindControl("CheckBoxPrintProvider"), CheckBox)        For Each lvi As ListViewItem In ListView1.Items            ' Dim chb2 As CheckBox = DirectCast(lvi.FindControl("CheckBoxPrintProvider2"), CheckBox)            ' Check if the checkboxes are checked             ' If (chb.Checked Or chb2.Checked) Then            '  If chb.Checked Then        &nbs

Can't access a control in a listview layout template with codebehind

While running ItemDetabound upon load of a listivew, I am trying to access the text in a label of the LayoutTemplate of a different Listview.  It works fine if I try access the same labels under the same names if they are in the same listview, but not if they are in a different one.  It was working for a while, can't figure out what I changed, but now says that object doesn't exist.   Here is the html code for the labels: <LayoutTemplate> <table ID="Table2" runat="server" cellpadding="0" cellspacing="0"> <tr ID="Tr1" runat="server" style="padding-left: 0px"> <th ID="Th1" runat="server" style="text-align: left; white-space:nowrap; "> <asp:Label ID="Label1" runat="server">Label 1</asp:Label> </th> <th ID="Th2" runat="server" style="white-space:nowrap; width: 150px" >

(trying to) Create a Listview control

Hello, I am trying to create a Winform-based Listview that uses the Client Object Model for Sharepoint 2010 to display a folder's contents similar to how a user would see it in Sharepoint. My first problem was accessing the view (which I was able with help to do), however, I found that the names of the columns in the view did not match the object property names for the objects. I am wondering if there is a "proper" way to do implement this. I am thinking I should be using a CAML query to pull back the necessary fields in the documents list, something like: My to-do list for this process is: 1: Determine the View I should be using -- is there a CAML query for that? 2: pull back the view columns w/ proper object property names -- I have the view, but the view returns improper object property names 3: Query SP (given view columns) for all docs under a certain folder something like: <RowLimit>25</RowLimit><br/> <ViewFields><br/> ... my fields from the view query ...<br/> </ViewFields><br/> <Where><br/> <Eq><br/> <FieldRef Name='FileDirRef'/><Value Type='Text'>http://myserver/documents/somefolder</Value><br/> </Eq><br/> </Where> 4: Cycle through each of the Results of step 3, transferring the info into the listview.   So, that's

Login Control Question

I want to put a Login Control and a Create User Control on the same page.. just wondering, before I start am I going to run into any problems by doing this? 

Binding ListView Control Using MVVM

In this short post I will show you how you can bind the list view control and get the selected value of the list view control using MVVM pattern. For this post I have added one list view control which hold the grid view control in it view and when item is selected in the grid view the selected item is shown at the end of the screen. In the Image 1the selected items are not shown ( only the label fields are shown) but in the Image 2 when user click on any of the item the detail is shown.

Finding a control inside a ListView on a master page

I have a listview on a master page that ISN'T part of a content place holder that I want to fill in and disable if the user is already logged in. I have a label set up already which works fine. I'm just having problems accessing a Textbox by the name of "NameTextBox" in the InsertItem template of the listview.Here is the part of my codefile:Dim vCurrentUser As MembershipUser = Membership.GetUser() If Not vCurrentUser Is Nothing Then Dim pnl As Label = LoginView1.FindControl("Label1") pnl.Text = Page.User.Identity.Name Dim NameBox As TextBox = ListView1.InsertItem.FindControl("NameTextBox") NameBox.Text = Page.User.Identity.Name End IfI get a Object not found exception. What is the correct way to find a control inside a InsertItemTemplate and the correct Event to use?

DataPager Manual input From Listview Control


Hi There,

I've been trying to marry up the listview and the Data pager with my own, Database class that pulls the information from the database.

I can display the information ok no problem, fortunately this time I know what the problem is, but I cannot figure out a way around the problem.

In my Page_Load event I fill out the listview accordingly:


Dim mList As List(Of Object) = mDbase.Record.Items("SELECT TBLResults.ID, Draw, [Date], B1, B2, B3, B4, B5, B6, BB, Jackpot, Wins, Machine, BallSet FROM TBLResults, TBLMachine WHERE TBLResults.MachineID=TBLMachine.ID ORDER BY Draw", GetType(ResultItem))


     Me.ListView1.DataSource = mList





The problem lies in the postback, I need to figure out a way get the information as to what state the DataPager is in so I could update the Query accordingly.

I know there is a StartRowIndex avaialbe but this does not get updated in the Page_Load event.

Has anybody got any ideas?

calendar control question



I'm using a standard .net calendar control on as asp.net webform. I'm using the DayRender event to get data from a database... currently, if one or more data matches are found for the day, I set the backcolor of the table cell, and set it's tooltip with relevant data from the data record. Now I need to handle the selectionChanged event and I need access to the data that was used in the DayRender event... I realize I can use the calendar's selectedDate property and re-query the database to get the data again, but I wanted to check to see if there are alternatives, and save the extra trip to the database. Is there something I can do in the DayRender event that will persist this data so that it gets passed to, or is available from the SelectionChanged event?

Question about Workflow in Document Library with version control and check-in/out enabled



I use Sharepoint Foundation 2010 and have a workflow to set some metadata in a document with version control and check-in/check-out enabled (approval content is not enabled because anyone in the team can be a possible editor of the document).

My metadata is:

- a generated doc id with text+id (example P&D_1)

- a calculated status based in version: minor version = "on development" and major-version="published/approved"

I defined two workflows:

1) is called when item is created to define id and status.

2) is called when item is updated and status is re-calculated if version is major. (It is called in every item change, not only when user wants to publish a major version, because this option doesn't appear in SPD)

I noticed that sharepoint workflow must do a check-out to be able to update metadata, and because of this the version number is incremented. When version is minor, I don't care, but when version is major I have a problem, because just after publishing the version 1.0, the workflow changes metadata and the version to 1.1. and 1.1 means that the document is not approved anymore...


a) Isn't it possible to do the workflow to check-in and override the last/current version to not generate a new version??

b) Or is it possible to stop versi

listview, keep a control



I'm building a list view that contains a list of message such as FaceBook...

I need to keep a textbox to have the text to insert, a label and a image

I tryed:

trycast(listview1.findcontrol("LabelExample"), label).text = "Username"

but it doesn't run :(

the label etc are in layout template and in the empty template

Plz help me ... :(

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend