databinding

getting row data from bindingsource bound to listbox

Hey! I have a listbox like so: list.DataSource = bindingSource; list.DisplayMember = "column_name"; Later I would want to get the selected item's ID from the DataSet with bindingSource.Current. I've done this before with bindingNavigator+bindingSource, Current returns a DataRowView, so I can cast it and I'm done: Int32.Parse(((DataRo...

Linq-ToEntities DataSource Assignment Hangs in Winforms

I have a very typical linq-to-entities data binding in WinForms: myGrid.DataSource = myEntities.entity When it reaches that line of code it simply hangs. Similar assignment a different entity work fine elsewhere in the code. The database contains no more than 50 lines of data in all entities (it's a new project) so it's not waiting on...

WPF - Databind slider value to StoryBoard?

Hi, I'm trying to create a sound volume control and for that I've created a storyboard which is animating the volume visually. And I've put this inside an common slider control. And I want to databind the value of the slider directly to the storyboards timeline position. If the slider is value 0, then the storyboard should be at 00:00 et...

C# Databound ComboBox Automatic Update

Hello, I have a combobox bound to a database table. When the user inserts a new piece of data into the table, I want the combobox to be automatically updated to display this data, however I am unsure of how I would go about doing this. Help would be greatly appreciated. ...

How to add a <td> tag to ListViewItem ?

I want to implement an apperance as this article mentioned using nested ListView control. However, in my scenario, I cannot use EntityDataSource control so I bind data manually. My table: Categories PK: UniqueId, Guid Name, string ParentId, Guid <asp:ListView ID="CategoryList" runat="server" onitemdatabound="CategoryLis...

Using ASP.NET MVC without an ORM

In my ASP MVC application I'm using standard SQL (rather that Linq to SQL or other ORM) to query my database. I would like to pass the database results to my view and iterate over the results in my view. But I'm not sure how to do this. Every example I've seen passes some string or uses L2S. I would like to pass something like neste...

JAXB: How should I marshal complex nested data structures?

Hello! I have several complex data structures like Map< A, Set< B > > Set< Map< A, B > > Set< Map< A, Set< B > > > Map< A, Map< B, Set< C > > > and so on (more complex data structures) Note: In my case it doesn't really matter if I use Set or List. Now I know that JAXB let me define XmlAdapter's, that's fine, but I don't want to def...

Databinding To A Property I Create In .Net 2.0

I'm doing some binding in .Net 2.0. It's been a hassle! I have a DataTable (I was trying to use a DataRow, but it was having none of that) and a BindingNavigator (which seemed to be the magic ingredient) with a BindingSource, and I'm programmatically binding controls to it. One of my columns, though, is an ID that I certainly don't want ...

ListBox not populating on data bind in Silverlight 2

So I'm trying to learn Silverlight so I've built a simple demo app that pulls my home feed from FriendFeed and displays the items in a list. I've got a listbox defined: <ListBox x:Name="lstItems" Margin="5,61,5,5" Grid.Row="1"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin...

Bind a IHierarchicalEnumerable to a treeview, and specify custom Images and navigation Urls

Hi, I have an external datasource that implements IHierarchicalEnumerable. I'm trying to use that datasource for my TreeView, but I can't find a way to specify the images and individual navigation urls the control should render (there is some business logic there). The examples I have seen all assume the Url and the Name and Image fiel...

How does DataAnnotationsModelBinder work with custom ViewModels?

Hi, I'm trying to use the DataAnnotationsModelBinder in order to use Data Annotations for server-side validation in ASP.NET MVC. Everything works fine as long as my ViewModel is just a simple class with immediate properties such as public class Foo { public int Bar {get;set;} } However, the DataAnnotationsModelBinder causes a N...

Databinding for checkbox with stringvalues

Hello everyone I have to bind datarows to my controls. So far so good. The problem now is, that my datarow contains only strings in the column I have to bind, but of course the property "checked" of a Checkbox takes only boolean arguments. Is there a way to use DataBinding here? Maybe with some kind of converter in between? Thanks ...

Listview not fully updating on databind() after postback

I have a ListView control which is exhibiting an odd behaviour - rows are only partially updating after a postback. I'm hoping someone here can shed some light on why this might be occuring. My listview DataSource is bound to a List of items which is stored in the page session state. This is intentional, partially to timeout out-of-da...

How to detect data binding completed in WPF

When I select an item on my treeview, there is a notable time gap from my viewmodel class being instantiated to the view refreshing and the treeview node being hi-lit. I need to show a wait cursor during this time - I've tried wrapping the code that instantiates my viewmodel class, but the cursor is back to an arrow a couple of seconds...

Silverlight DataBinding Against CLR Objects in Blend

I love the feature in Blend where you can setup databinding to CLR Objects, and design your Silverlight control/page. My issue is around the creation of a user control that will be used as a DataTemplate. It all works great in Blend, but only at design time. The issue is that when I am editing the control in Blend, and I bind say a textb...

WPF - Cannot convert '<null>' from type '<null>' to type 'System.Uri'

I have a simple user control to display a hyperlink in a textblock: LinkTextBlock.xaml: <TextBlock > <Hyperlink NavigateUri="{Binding Url, ElementName=root}" > <TextBlock Text="{Binding Text, ElementName=root}" /> </Hyperlink> </TextBlock> LinkTextBlock.xaml.cs: public static readonly DependencyProperty UrlPropert...

Editing a DataGridView which has bound and updating columns in C#

I have a DataGridView where the DataSource is a BindingList. Most of the columns are updated -- via various timers which call PropertyChanged("...") for the bound columns. One column -- the problematic one -- is a DataGridViewComboBoxColumn -- where the user selects an item from the list of Items. The problem is that the DataGridViewC...

WPF Generic DataGrid CellTemplate - Bind to Cell Value?

I'm having a problem understanding the basics of databinding in WPF. I have a generic DataGrid (with AutoGenerateColumns set) that is bound to a DataTable with column names that vary on every load. When the dataTable contains columns that are of type boolean, I want to render a column that contains custom images representing true and fal...

Asp.net databindings losts after postback

HI everyone, I'm having the following issue that is really driving me crazy. After I perform any sort of postback, several controls do not rebind themselves, for instance DetailsView with an attached ObjectDataSource (in my case ObjectContainerDataSource) LoginView is not showing the LoggedInTemplate but LoginStatus is showing me as lo...

SqlCommandBuilder Only Sends Nulls To The Database

I have a SqlDataAdapter with a SqlCommandBuilder attached to it. public SqlDataAdapter SelectNone(string Table) { SqlDataAdapter result = new SqlDataAdapter(); SqlCommandBuilder builder = new SqlCommandBuilder(result); builder.ConflictOption = ConflictOption.OverwriteChanges; builder.SetAllValues = true; result.Sele...