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

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

Bind a ListView to a return value from a method

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :WPF
I have a ListView in my View that I would like to bind to the return value of a method on my ViewModel. View:   <ListView DataContext={???}" />   ViewModel:   public void GetParameters(string foo) { return myObj.FindParameters(foo); }   My question is, what would the binding syntax look like on the View's ListView to call GetParameters, and pass in a parameter (argument)?  

View Complete Post

More Related Resource Links

ListView DataPager with SQL-Statements that already return only paged data.



As far as I understand the ListView-Control and the DataPager-Control, they work like this: The ListView gets its datarows from its data source, then the DataPager causes the ListView to display only a subset of those rows.

So what, when I want to use custom databinding for the ListView, that *already* gets the certain subset from SQL-Server (for better performance). Can I and how can I use the DataPager then?

Thanx, S.

listview 3.5 bind dropdownlists edit item template VB.NET


I am trying to do this with many issues of data binding doubling the amount and not setting selectedValue on dropdownlist. I have read some posts and they help but I am missing a crucial piece. My problem is that my dropdownlist is doubling the amount of records for the dropdownlist. Instead of "YES;NO;SELECT A VALUE", I am getting "YES;NO;SELECT A VALUE;YES;NO;YES;NO". My database is correct with the UPDATE part but the rebind after update is failing horribly.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            If Session("ACTIVETAB").ToString() = Session("SUBCONTRACTSATABNO").ToString() Then
            End If
        End If
    End Sub

    Public Function loadlookups(ByVal id As String, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) As DataTable
        Select Case id
            Case "ddlCertReceived"
                dt = GetLookupTable("SubcontractsA", "Sub 1 Cert Received")
                Dim ddlCertReceived As DropDownList = _
                CType(e.Item.FindControl("ddlCertReceived"), DropDownList)
                ddlCertReceived.DataSource = dt
                ddlCertReceived.DataTextField = "lup_text"

Bind GetAllUsers To ListView with ItemDataBound

Hello all, I am using a listview to which I want to bind the MembershipUserCollection which you get from GetAllUsers(). I don't want to use reflection, I want to assign it in the ItemDataBound event of my listview. I've done this before, but with datatables. The code will be something like DataRow dr = (e.item.DataItem as DataRowView).Row. You can then access specific columns with dr["ColumnNamehere"].ToString(). But how do you do this with MembershipUserCollection?

XML Bind in LIstView


I made a ListView bind with ObservableCollection.

It have two column(TimeStamp, Message).

But messageColumn is dynamic xml string, how can I made messageColumn to treeview as GridViewColumn? 

listview bind to detailsview


I have a listview that is bound to a table. I want to select a record from the listview and that record display in the detailvew from which I can edit. How do you bind these two controls so the detailview uses the records selected in the listview?

how can i return 401 error from a method return ActionResult?


how can i return   401 error from a method return ActionResult?

Bind .NET ListVIew to Sharpoint list with Eval


I have a rather basic question of something that I just can't get to work. I have a user control with a ListView control. In the code-behind for the user control I bind the control to a SharePoint list.

Now, I want to render the items in a certain way in the LayoutTemplate and ItemTemplate sections of the ListView. I try to do this by binding to the columns with Eval, but this binding never returns any data work... 


This is some of the ascx:


<asp:ListView ID="ListView1" runat="server">
  <asp:PlaceHolder ID<

Can a method return multiple types?



I have two methods that do the similar thing. There are small differences here and there, which I can control by passing arguments to them when I call them, so I can effectively merge them. However one returns a string, and the other one an ArrayList.

On the top of my head, I could merge them and return an Object, and then get the information I need.

Is there a way though to return multiple types in the method's signature?

What's the proper way to implement this?


Revised Question XML Value Method Return Multiple Rows


Question earlier asked and answered to run query to collect sql data from xml schema

was able to collect the scheme from node but query did not return data but xml string


I ran this query

select x.col.value ('




cross apply



XML Value Method to return multiple records


I am new in XML SQl i have created a schema with namespace in SQL 2005; I can return single records with the following query using table and column name; however, i do not understand how to return multiple (nodes) records from xml segments where there are multiple (same) elements.

Here is the query which works with one record, when trying to declare the Namespace to use nodes get error

The schema is an HIPAA 837 schema with multiple elements ; Table name = PATIENTTRAC_SUBMISSION_HISTORY; xml field = PATIENTTRAC_EDI_SUBMISSION




Webmatrix.Data.Database.Query() method return type


I'm using the Webmatrix.Data.Database.Query method to return a result set in the following form

var myResult = db.Query("Select * from mytable");

How do you cast myResult to get the count of records returned? I'd like to do something like


using a stored procedure for a listview, I am trying to only return items in a column of a table tha


I am trying to create a stored procedure that when fed a session parameter, it will only find items that  start with a particular character.  For example, if I have a table named table1, and a column name col1, then if I have 10 items in the column and 5 of them start with the letter c, I want to use a stored procedure to onlly return the items that start with a c.

I am sure it is somethin like:


FROM table1 

WHERE col1 = "c??????????"

How to clear Bind ListView?


How to clear bind listview?


Return list of items to a controller method


I have these tables in my database - Presses, Paper, and PressPaperSpeeds:

PressID (PK)

PaperID (PK)

PressPaperSpeedID (PK)
PressID (FK)

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

WPF Tutorial - Using The ListView, Part 1

Many of the controls in WPF have a downright dizzying array of capabilities and features, due in large part to the composibility of all the components. The ListView control is a great example of this - the possibilities are almost endless. This series of tutorials on the ListView will hopefully make the space of possible options seem not quite as daunting
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