.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

wpf Datagrid bound to a Simple List of Long values - not so simple

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :WPF

Somewhere I've lost the plot.  I have a complicated senario, and solved most of it, but still I have one issue that illudes me.  Here goes

User Control has custom Dependancy Properties so that it can bind to it's host window.  One property Route is a string.  The string is actually a comma delimited list of long (BigInt stored values in SQL 2008r2 - pulled through a DataSet, then parsed into a string) ex.  "9,6,12"  Real simple so far.  The user control binds a CollectionViewSource to this string, and uses a custom converter to turn the string into a list(of long)... (or ObservableCollection(of Long), or BindingList(of Long))  The key is the value must be a long, when pulled.  Next enters the DataGrid...

I have a datagrid with 1 column.  Its a DataGridComboBoxColumn.  Its item source is bound to an actual dataset.datatable based CollectionViewSource called RoutingLocations.  A simple list of ID,Abbrev,LocationID.  I bind the DisplayValue to Abbrev.  So I get a nice lookup of the RoutingLocations in the comboBox Column.  Then my list(of Long) gets attached to the DataGrid as it's ItemSource.  End Result  I get 3 rows properly displaying the selected Abbrev for the supplied ID.

Now the problem.  I can not get this datagrid to update the source (it nev

View Complete Post

More Related Resource Links

Help: Too many lines of code to achieve a simple goal: keep my NULL SQL values...


Hello all

What is the best way (best practice) to preserve my NULL SQL values in the database
during an insert/update operation (without receiving cast invalid errors)?
Also, how to display a string 'n/a' when a sql value is NULL?

My project is using FormView with Edit/Insert templates and classes to represent my tables

Goal1....: display 'n/a' when there are NULL SQL values in the database
Solution1: I am using ISNULL(field,'') in my store procedure for SELECT statements

Goal2....: if the fields are 'n/a', then save them back in the database as NULL
Solution2: on my insert/edit methods I am having to check the values being passed, i.e:

cmd.Parameters.Add(new SqlParameter("@scope", SqlDbType.NVarChar, 50));

if (item.Scope == "n/a")
 cmd.Parameters["@scope"].Value = DBNull.Value;
 cmd.Parameters["@scope"].Value = item.Scope;

Not to mention that for SQL DateType fields when you use ISNULL(field,'') the return string is '1/1/1900 12:00:00 AM'
and I have to change the field value in every field that represents a date, i.e:

protected void FormView1_DataBound(object sender, Sy

how to create a List order and unourder a simple Sql Query

A Simple Query Pass to connection String 1 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.COFROM V_HIERARCHY1 a   2,My Data is HD    HEAD    SH    SUBHEAD    TRK    TRACK    TGT    TARGET    PDC    DT_RELEASE    STATUS    COHR    HR    Rec    Records    Leave    Leave Records    HRL.0002    Quarterly Review    01.07.2010    04.07.2010    Planned    EdlinkHR    HR1    DB    Database    SAL    Salary    DDS.0001    Calculation of Monthly salary    08.08.2010    09.08.2010    WIP    EdlinkHR    HR    Rec    Records    Ind    Induction Records    HRI.0001    Completion of dossiers.    08.07.2010    10.07.2010    WIP    EdlinkHR    HR  

Simple binding trouble with a list box


Dear all,

I inherite from a code of a collegue who left the company and I get some troule with a binding in it.

I have a list box binding which is define has follow :

              x:Name="lbScheduler" Grid.Row="0"

As you can see from code above, there is a binding to ItemSource, but in code I could not find any datacontext set. This is the first thing.
Then if I add items to the list box trough a  button dircetly from user interface whihc does lblScheduler.Items.Add(...), then I can see the item correctly display in the listbox.

But during the running of the application, when clicking on a particular buton, some asynchrone process happen which in fact take the list of items in this listbox and then store that list in database.

What it happenning is that right after pressing that button, my list box gets empty and my previous items desapears .

Then right after the button click even, I simply add the following code :

  lbScheduler = _ListBoxSchedulerHelper.

Moss Simple Search not searching new items in list until keyword is "propertyName:Keyword" i.e Custo



Problem : Simple search not showing the new items created in list. It shows the new items if searched with keyword as  "propertyName:Keyword" i.e CustomeName:John

There is a metadata property "CustomerName", which is mapped to a custom column(Customer Name) in a sharepoint list as ows_CustomerName(Text). Also there is a scope(Customers) created which has folder set to URL of the sharepoint site containing this list.

The items are indexed for sure as they are searchable if simple search keyword is  "propertyName:Keyword" i.e CustomeName:"John Smith" . But not searchable if the keyword is John Smith

Is there anything missing??

Simple Way To Create CheckBox List In Silverlight

We have a requirement to create the Checkbox list control so that user can select multiple options from a given list for his/her choice.

2 Simple Ways to Create Custom List in SharePoint 2013

A Custom List is a collection of different type of columns and information pieces which are collaborated together and is developed with some unique set of properties which provides user to access form features.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

A Simple and Extensible Radio Button Style GridView

The GridView is one of the significant controls in ASP.NET 2.0 and later versions. No doubt it reduces a lot of work time. However, customizing the GridView control is not an easy task. For example, it's hard to add a radio button column to the GridView. This article demonstrates the reason why a radio button column cannot act as normal and how to create a simple and extensible radio button GridView.

Silverlight Simple Animation

Silverlight has several built in techniques for animating controls. Many of these technologies are particularly useful for creating simple animations meant to decorate a web page with eye catching movement that draws the reader's attention. In this post I will skip over these decorative technologies, and instead show how to create a simple animation using a technique similar to those used in many games.

I thought this would be simple... Trying to create a login does an ajax check before submit


I have the standard .net login control that is working.  (Still learning .net after 15yrs of classic)

What I want to do is OnButtonClick run a javascript function (to do an ajax call to the db to check if login is valid or not) and if it returns true, then submit the form normally, else don't submit. The piece that I can't figure out, is how to correctly override the default click even to hit my JS routine and then submit the form properly afterwards.

Thanks ahead of time

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


Easy Async: Build Concurrent Apps From Simple F# Expressions


In this article, the author explores how the F# language helps you create asynchronous function libraries that can be called seamlessly from any other .NET-compliant language.

Chance Coble

MSDN Magazine October 2008

Wicked Code: Silverlight Page Turning Made Simple


As we'll show, with just a few lines of JavaScript you can build a general-purpose framework for incorporating page turns into Silverlight 1.0 apps.

Jeff Prosise

MSDN Magazine May 2008

Secure Habits: 8 Simple Rules For Developing More Secure Code


Never trust data, model threats against your code, and other good advice from a security expert.

Michael Howard

MSDN Magazine November 2006

Mutant Power: Create A Simple Mutation Testing System With The .NET Framework


With mutation testing, the system under test is changed to create a faulty version called a mutant. Here James McCaffrey explains how to do this in .NET.

James McCaffrey

MSDN Magazine April 2006

Windows UI: Our WinMgr Sample Makes Custom Window Sizing Simple


Programmers using Visual Basic have always had an advantage over C++ programmers when it comes to component and window sizing. There are many third-party Visual Basic-based solutions to this age-old problem, but unfortunately, there are few elegant alternatives for the C++ crowd, short of using a full-fledged windowing toolkit. This article explains how to circumvent the tedious task of hardcoded pixel arithmetic. It starts by introducing a window sizing rules system, and then moves on to show how CWinMgr, a data-driven class, can intelligently manage an MFC application's window sizing.

Paul DiLascia

MSDN Magazine July 2001

XML in .NET: .NET Framework XML Classes and C# Offer Simple, Scalable Data Manipulation


Microsoft .NET introduces a new suite of XML APIs built on industry standards such as DOM, XPath, XSD, and XSLT. The .NET Framework XML classes also include innovations that offer convenience, better performance, and a more familiar programming model, tightly coupled with the new .NET data access APIs-ADO.NET. XmlWriter, XmlReader, and XmlNavigator classes and classes that derive from them, including XMLTextReader and XMLTextWriter, encapsulate a number of functionalities that previously had to be accomplished manually. A discussion of the XMLDOM-Document is also included.

Aaron Skonnard

MSDN Magazine January 2001

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