databinding

Why does my comboBox go blank after selecting a value?

Given my table primary table for the binding navigator: CREATE TABLE [dbo].[asset]( [assetID] [int] IDENTITY(1,1) primary key, [assetTag] [varchar](15) NULL, [assetModelId] [int] NOT NULL, [employeeId] [int] NULL references employee(employeeid), [LocationId] [int] NULL, [purchasedDate] [smalldatetime] NULL, [purchasedby] [int] NULL refe...

inserting items to dropdownlist

Hi friends, I want to display the items in my dropdownlist2 (from table 2 )based on the selected item of the dropdownlist1(from table 1) . in the following, i just tried to select the lang column values from table2 based on the value which is in the dropdownlist1..((just to insert into the dropdownlist1)) is that correct code...? ...

Windows Forms simple example showing Radiobutton DataBinding

Question is for Windows Forms DataBinding Let's say this is my custom class public class SimpleClass : INotifyPropertyChanged { public Name {get; set;} char OrderType; ... } OrderType is P for purchase order, S for sales order. I for Invoice etc that I need to show as a group of radiobuttons on the Windows Form for textb...

WPF-ListBox-Multibind Howto...

Here's the situation: ListBox has a ItemSource that gets its display and value data from Table A: Table A ID Activity 1 Skiing 2 Hiking 3 Fishing TableB has a list of people TableB ID Name 1 Tom 2 Dick 3 Harry TableC is an xref that joins up a list of people with their preferred activities... ...

Extending IEnumerable to Return BindingList

In a previous question on Stack Overflow, I had run into an issue with returning an EF query to the DataGridView. Of course I'd run into an issue. However, I added an extension method that still has me baffled since it isn't working. It seems like it should, but for some reason it's not. public static class BindingListEntityExtension { ...

Displaying Repeated Items in a GridView

I have a GridView bound to some XML data that looks like this: <Root> <Column1> <Item1 type="l1style">Item 1</Item1> <Item2 type="l2style">Item 2</Item2> <Item3 type="l3style">Item 3</Item3> </Column1> <Column2> <Item4 type="l1style">Item 4</Item4> <Item5 type="l2style">Item 5</Item5>...

TableAdapter.update method, where did it go?

I made a ListBox with your standard smart-control thing, and have it connected to a database. It gets the data I've pre-generated in there via query builder, so when I do this: this.calibrate_swipesTableAdapter.Fill(this.xperdex_crandallDataSet.calibrate_swipes); I get a listbox with my data. THEN, when I add a chunk of data to it, ...

Make properties available for data binding through some kind of interface in .NET?

I have a class that implements properties in a specific way, to handle some custom requirements for our business logic system. This "specific way" makes the properties non-operational in the context of data binding. Basically, if I drop an object of our class onto a form, data binding finds nothing on the object, and the property inspec...

Multiple BindingSource components necessary for just one data source?

As per my previous question, Make properties available for data binding through some kind of interface in .NET?, I managed, with the help of @Marc Gravell that by implementing the interface ICustomTypeDescriptor I can provide the form designer with custom properties that may or may not actually be visible on the component in question as ...

Databound DateTimePicker fires validation error

I have a databound DateTimePicker: dateDateTimePicker.DataBindings.Add(new Binding("Value", paymentBindingSource, "Date", true); paymentBindingSource.DataSource = payment; payment is Entity Framework object. payment.Date contains valid DateTime. When form is shown, dateDateTimePicker contains correct value, but an ErrorProvider is sho...

How can I draw a WPF polygon with openings?

I have a collection of custom "PlanarMember" objects exposing Boundary and Openings properties. The Boundary property is a custom "Polygon" class exposing vertices and segments, etc. The Openings is an IEnumerable basically describing openings in the larger polygon. I can guarantee that the openings do not overlap/intersect, the outer ...

WPF UserControl exposing inner listitems

I'm trying to write a UserControl to display a list of items where each of these items is a title and a group of checkboxes. This whole will represent a form of data where the person filling it in is answering a list of questions with a 1 to 4 value. This all works and binds nicely to the window's ViewModel. But I've currently got the a...

WinForms, BindingSource, prevent CurrentItem change

How can I prevent bindingSource Current item from changing? (there is no changing event with cancel argument...) This is scenario: I have a dataGridView, and text-boxes on the same form. I am using text-boxes to change values in the datasource (with standard databinding) Bindings are written manually (After save button is clicked) Whe...

How do you insert a binding into the middle of a sentence of a TextBlock in WPF?

I'm looking for something along these lines: <TextBlock Grid.Column="1" Text="Welcome, {Binding UserName}!" /> This will of course actually display the text "{Binding UserName}" to the user rather than decode it, but I know you can do something like this with ASP.NET, so I'm hoping there's a way to get this to work in WPF. I'...

Form View Manually Setting the DataSource Does not Show Template

I am currently programming an ASP .NET FormView. The twist here is that I need to manually set the datasource via "FormView.DataSource = ". I added an ItemTemplate and added some form in the form view but even if the line of code that set the datasource view is called and the FormView.DataBind() is called, I still cannot see the data. I...

How can I define a custom (datamember) view for a databound sealed object on a combobox?

Take System.Drawing.Point for example. If wanted to bind a few points to a comboBox with a special view that displays: Point 1: 1, Point 2: 2 Point 1: 5, Point 2: -3 ... Point 1: -7, Point 2: -6 Since I can not modify System.Drawing.Point, and I would like a solution that works for a large dataset coming from a database, is there a way...

Can't get ListBox and UpdateTarget to work

Here are the relevant parts of the XAML file: xmlns:local="clr-namespace:BindingTest" <ListBox x:Name="myList" ItemsSource="{Binding Source={x:Static local:MyClass.Dic}, Path=Keys, Mode=OneWay, UpdateSourceTrigger=Explicit}"> </ListBox>...

Dynamic Id's not working in a GridView. Is there any way to prevent duplicate id's in a gridview?

My gridview has a template field with a label in it. I want to label the field using the QuestionID so that it doesn't create duplicate id's. I tried doing the following: <asp:TemplateField HeaderText="No"> <InsertItemTemplate> <label id='<%# (string.Format("Label_{0}", DataBinder.Eval(Conta...

How do I bind a WinForms DataGridView control to a SQL Server database

I am a .NET noob who is trying for figure out how to bind a grid control to a SQL Server database so that when rows are inserted, updated or deleted from the grid, they are also inserted, updated or deleted from the database. C#, .NET 3.5, VS2008 SP1 Warren ...

WPF: Problem with ItemsControl datatemplate as a user control

This works fine: <ItemsControl ItemsSource="{Binding Persons}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock ...