Click here to Skip to main content
15,888,250 members
Home / Discussions / C#
   

C#

 
QuestionSimilar Video retrival [modified] Pin
Mads11519-Sep-09 1:07
Mads11519-Sep-09 1:07 
AnswerRe: Similar Video retrival Pin
Eddy Vluggen19-Sep-09 2:13
professionalEddy Vluggen19-Sep-09 2:13 
GeneralRe: Similar Video retrival Pin
Mads11519-Sep-09 2:41
Mads11519-Sep-09 2:41 
GeneralRe: Similar Video retrival Pin
Eddy Vluggen19-Sep-09 2:46
professionalEddy Vluggen19-Sep-09 2:46 
GeneralRe: Similar Video retrival Pin
Mads11519-Sep-09 3:22
Mads11519-Sep-09 3:22 
GeneralRe: Similar Video retrival Pin
Eddy Vluggen19-Sep-09 3:29
professionalEddy Vluggen19-Sep-09 3:29 
QuestionClick Once Deployment for solution Pin
Abdul Rahman Hamidy19-Sep-09 0:09
Abdul Rahman Hamidy19-Sep-09 0:09 
QuestionObservableCollection bound to ListView Pin
b4ip18-Sep-09 23:54
b4ip18-Sep-09 23:54 
Problem
WPF Project (VS 2008)

I'm using a ListView (with GridView) bound to an ObservableCollection. The collection includes a DateTime field.
When I populate the collection, the DateNR field is often null, but then the ListView displays a date of "01-Jan-01"!!

How do I stop this as I don't want the user to see a date when there shouldn't be one. I need the DateNR field in the collection to be a DateTime value not a string because this column is used for sorting.

Any ideas would be welcome. thanks

<code>
public class RecordData
{
public int ID { get; set; }
public DateTime DateNR { get; set; }
}

Adding GridView Column
GridViewColumnHeader gvch = new GridViewColumnHeader();<br />
GridViewColumn gvc = new GridViewColumn();<br />
Binding bind = new Binding("DateNR");<br />
bind.Converter = new FormattingConverter();<br />
bind.ConverterParameter = @"{0:dd-MMM-yy}";<br />
gvc.Width = 80;<br />
gvc.DisplayMemberBinding = bind;<br />
gvch.Content = "NR Date";<br />
gvc.Header = gvch;<br />
myGridView.Columns.Add(gvc);


Populate Collection
 SqlConnection sqlConn = new SqlConnection(myConnectionString);<br />
 SqlCommand sqlComm = new SqlCommand("...", sqlConn);<br />
 SqlDataReader sqlDR = sqlComm.ExecuteReader();<br />
 // ...<br />
 RecordData rd = new RecordData();<br />
 rd.ID = sqlDR.GetInt32(0);<br />
 if (sqlDR.IsDBNull(1) == false)<br />
     rd.DateNR = sqlDR.GetDateTime(1);<br />
 // ...<br />
_MyCollection.Add(rd);

AnswerRe: ObservableCollection bound to ListView Pin
Manas Bhardwaj18-Sep-09 23:58
professionalManas Bhardwaj18-Sep-09 23:58 
QuestionSelect treenode automatically Pin
kmb8918-Sep-09 21:59
kmb8918-Sep-09 21:59 
AnswerRe: Select treenode automatically Pin
Christian Graus18-Sep-09 22:23
protectorChristian Graus18-Sep-09 22:23 
GeneralRe: Select treenode automatically Pin
kmb8918-Sep-09 22:39
kmb8918-Sep-09 22:39 
GeneralRe: Select treenode automatically Pin
Christian Graus18-Sep-09 22:40
protectorChristian Graus18-Sep-09 22:40 
GeneralRe: Select treenode automatically Pin
kmb8918-Sep-09 22:50
kmb8918-Sep-09 22:50 
GeneralRe: Select treenode automatically Pin
Christian Graus18-Sep-09 22:56
protectorChristian Graus18-Sep-09 22:56 
GeneralRe: Select treenode automatically Pin
Christian Graus18-Sep-09 23:08
protectorChristian Graus18-Sep-09 23:08 
GeneralRe: Select treenode automatically Pin
kmb8918-Sep-09 23:31
kmb8918-Sep-09 23:31 
GeneralRe: Select treenode automatically Pin
Malcolm Smart19-Sep-09 2:31
Malcolm Smart19-Sep-09 2:31 
GeneralRe: Select treenode automatically Pin
PIEBALDconsult19-Sep-09 8:50
mvePIEBALDconsult19-Sep-09 8:50 
QuestionHow to set focus on a control in MVVM pattern. Pin
AmitSumit18-Sep-09 19:59
AmitSumit18-Sep-09 19:59 
AnswerRe: How to set focus on a control in MVVM pattern. Pin
Christian Graus18-Sep-09 20:13
protectorChristian Graus18-Sep-09 20:13 
AnswerRe: How to set focus on a control in MVVM pattern. Pin
Ravi Mori18-Sep-09 20:45
Ravi Mori18-Sep-09 20:45 
QuestionConverting Business Object to Data Transfer Object Pin
Saiyed Alam18-Sep-09 19:04
Saiyed Alam18-Sep-09 19:04 
AnswerRe: Converting Business Object to Data Transfer Object Pin
Christian Graus18-Sep-09 19:11
protectorChristian Graus18-Sep-09 19:11 
GeneralRe: Converting Business Object to Data Transfer Object Pin
Saiyed Alam18-Sep-09 20:52
Saiyed Alam18-Sep-09 20:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.