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


Post New Web Links

CollectionViewSource Source = Linq to SQL

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :WPF
 
Hi, I am trying to bind data in my WPF Application using CollectionViewSource and LINQ to SQL. I have the following code in my XAML Where dbml:VendorsDataContext is my dbml file. In the code behind i have written the following code: addressViewSource.Source = bpo.GetVendorAddrTable(_vendorID); Where GetVendorAddrTable has the following code: var addr = from a in vendorsDC.tblVendor_Addresses where a.vendorID == _vendorID select new BussinessHelper.AddressContacts { VendorID = a.vendorID, Address1 = a.address1, Address2 = a.address2, City = a.tblVendor_City.cityName, State = a.tblVendor_State.stateName, Country = a.tblVendor_Country.countryName, VendorAddrID = a.vendorAddressID, CompleteAddr = a.address1 + a.address2 + a.tblVendor_City.cityName + a.tblVendor_State.stateName + a.tblVendor_Country.countryName                        };                  return addr;  When i run my application there is no data being bound. The CollectionViewSource source is null when i checked with code behind. Any ideas how to correct this?


View Complete Post


More Related Resource Links

linq to sql varbinary assign to image source

  
Hi All, can you please tell me why this doesnt work:   <Grid> <Image Source="{Binding Path=currentUser.userStatus.icon.bm}" Width="89" Height="90" Margin="309,140,270,99" Name="im" /> </Grid>   where as if I assign the image source via the code behind it does? im.Source = currentUser.userStatus.icon.bm; The currentUser.userStatus.icon.bm object is a BitmapImage type generated from a database varbinary field using linq to sql partial methods like this:   public partial class icon { public BitmapImage bm = new BitmapImage(); public System.Drawing.Icon ic; public System.Drawing.Image img; partial void OnLoaded() { byte[] data = (byte[])this.imageBinary.ToArray(); MemoryStream strm = new MemoryStream(); strm.Write(data, 0, data.Length); strm.Position = 0; img = System.Drawing.Image.FromStream(strm); System.Drawing.Bitmap b = (System.Drawing.Bitmap)img; ic = System.Drawing.Icon.FromHandle(b.GetHicon()); //string imagePath = "Icons/go-down-8.ico"; //System.Drawing.Image img = System.Drawing.Image.FromFile(imagePath); //BitmapImage bi = new BitmapImage(); bm.BeginInit(); bm.DecodePixelWidth = 128; MemoryStream ms = new MemoryStream(); if (this.ext

Urgent How to Create it ,Object Data Source ,Linq and sql or other any way

  

my query is

SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.CO
FROM V_HIERARCHY1 a

 

my data is

HR    HR    Rec    Records    Leave    Leave Records    HRL.0001    Policy and Process for leave record.    27.06.2010    30.06.2010    WIP    Edlink
HR    HR    Rec    Records    Leave    Leave Records    HRL.0002    Quarterly Review    01.07.2010    04.07.2010    Planned    Edlink
HR    HR    DB    Database    SAL    Salary    DDS.0001    Calculation of Monthly salary    08.08.2010    09.08.2010    WIP    Edlink
HR    HR    Rec    Records    Ind    Induction Records    HRI.0001    Completion of dossiers.    08.07.2010    10.07.2010  

LINQ data source control and db connection string

  

I have designed a few pages which use LINQ datasources and Gridviews to maintain data.

I have built a data layer which happily uses System.Web.Configuration.WebConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString

However, the LINQ data source controls use Settings.designer.vb MySettings class definition which is auto generated and doesn't except the above Connection string.

Any ideas?



Playing with Linq grouping: GroupByMany?

  
One of its features is grouping. Many people understand grouping like it is defined in Sql. Linq is implementing grouping quite the same way. Let's discover this syntax and how to make consecutive groups easier.

LINQ : Implementing IN and NOT IN

  
I got tried of typing

var result = from s in source
where items.Contains(s)
select s;and so I implemented the IN and NOT IN methods as extension methods:

101 LINQ Samples Tutorials

  
101 LINQ Example with sample code snippets....This sample prints each element of an input integer array whose value is less than 5. The sample uses a query expression to create a new sequence of integers and then iterates over each element in the sequence, printing its value

Linq: how to share parameters between lambda expressions ?

  
When using Linq to objects, you will quickly feel the need to pass some parameters from a method to another but it's not so easy because each Linq method is not calling the following one. In a Linq sequence, each method is using the result computed by the previous one. So, local contexts are not visible from one method to another.
The compiler is using two technical different ways to let parameters go out of a method.

Linq to Sql CompiledQuery container

  
Ok now let's go. Here is just a little trick but with some interesting patterns that could be useful in some other contexts not connected to Linq to Sql.

When using Linq expressions, like with Linq to Sql, translating the expression into something else (sql for example) is taking time and resources. Sometimes it's negligible, sometimes not...

LINQ to SQL Paging using GridView in C# and ASP.NET 3.5

  
This tutorial will show you how we can extend the LINQ to SQL Class and create methods that will allow us to page data from a SQL database. C# version.

What is Lambda Expressions In LINQ

  
A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.

All lambda expressions use the lambda operator =>, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x." This expression can be assigned to a delegate type as follows:

How to create 3 tier application using LINQ

  
As you know that in 3 tier architecture there are three layers

User interface layer. (Is our Form in Windows application and .aspx page in Web application)
Data Access layer. (Which provides interface between Business logic layer and Database)
Business Logic layer.(Which stores your application logic)

Microsoft StyleCop: Source Code Analyzer for C#

  
StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

Building a LINQ Provider

  
Throughout this article, we will build a simple IQueryable provider similar to the LINQ to SQL provider demonstrating what is needed to build a custom provider that is capable of executing LINQ queries and performing create, update and delete operations.

C# and XML Source Code Documentation

  
Through many years of enterprise level software development and consulting, I became critically aware of the importance of good source code documentation, and several years ago when I began working with the first release of Visual Studio .NET beta 1 and found C# provided built-in support for inline XML code documentation, I was thrilled.
Categories: 
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