this is a wpf/c# app - I have one grid where I used text boxes and the data bindings were fine. I later built another grid using textblocks. both worked well. but when I changed the textblocks in the second grid into textboxes, all but one stopped displaying data.
I copied both the c# LINQ code and the XAML code that provide the data for the bindings, recompiled, saved it to NotePad++, and closed VS(8). After reopening the project, I reinserted the code, but I still got no data.
Any ideas that would help would be greatly appreciated.
Here's the c# code
var vendDetail = from v in dbC.Vendors
where v.VendorID == vendorid
select new
{
v.Address1,
v.Address2,
CSZ = v.City + ", " + v.State + " " + v.Zip,
v.Phone,
v.Fax,
v.Contact,
v.Terms,
v.eMail
};
grVendorData.DataContext = vendDetail;
And the XAML code:
<TextBox x:Name="txtVendorAddr1"
Text="{Binding Path= Address1}"
Background="AliceBlue"
Grid.Row="2"
Grid.Column="1"/>
<TextBox x:Name="txtVendorAddr2"
Text="{Binding Path= Address2}"
Grid.Row="3"
Grid.Column="1"
Background="AliceBlue"/>
<Label Content="City"
Grid.Row="4"
Grid.Column="0"/>
<TextBox x:Name="txtVendorCity"
Text="{Binding Path= CSZ}"
Grid.Row="4"
Grid.Column="1"/>
<Label Content="Phone"
Grid.Row="1"
Grid.Column="0"/>
<TextBox x:Name="txtVendorPhone"
Text="{Binding Path = Phone}"
Grid.Row="1"
Grid.Column="1"/>
<Label Content="Fax"
Grid.Column="2"
/>
<TextBox Text="{Binding Path = Fax}"
Grid.Row="0"
Grid.Column="3" />
<Label Content="Terms"
Grid.Row="2"
Grid.Column="2"/>
<TextBox Text="{Binding Path = Terms}"
Grid.Row="2"
Grid.Column="3"/>
<Label Content="Notes"
Grid.Row="3"
Grid.Column="2" />
<TextBox Text="{Binding Path = Notes}"
Grid.Row="3"
Grid.Column="3"
Grid.RowSpan="2"
TextWrapping="WrapWithOverflow" />
<Label Content="eMail"
Grid.Row="1"
Grid.Column="2" />
<TextBox Text="{Binding Path = eMail}"
Grid.Row="1"
Grid.Column="3"/>