binding

How do I bind my controls in a WPF DataGridTemplateColumn to a DataTable?

I have a DataGrid bound to a DataTable that I want to make custom columns for using a DataGridTemplateColumn, but I'm not sure how to reference the value in the cells of the DataTable. Every example I see online either binds the DataTable and doesn't change the templates, or uses a custom object and references the properties of the bound...

Unboxing an Object type to a primitive and other types (simulating late-binding)

I have a class that contains Append-like members for each primitive type, string and INetSerializable: public class TypeAppender { public void Append(int i ) {} public void Append(double d) {} public void Append(string s){}i){} public void Append(INetSerializable ins){} } From a different ...

Java binding JTextField -> java.lang.Integer problem

I have a text field which is bound with Integer variable, so when user enters number into this field, binding mechanism automatically converts text into Integer and sets this value into var. Problem is, since user types text into text field, that binding mechanism is converting only values, and if user types some letters into it, binding...

Default model binder and complex types that include a list

Hi All I'm using RC1 of ASP.NET MVC. I'm trying to extend Phil Haack's model binding example. I'm trying to use the default model binder to bind the following object: public class ListOfProducts { public int Id { get; set; } public string Title{ get; set; } List<Product> Items { get; set; } } public class Product { pu...

Binding of IP address with Session id

To prevent the session fixation problem, who can we bind the IP address with session id? Is it possible to bind th session id with that of Ip address?? ...

How can I access the root DataContext in a DataTemplate in WPF?

I have a grid of items which is populated using databinding. In the grid I have a DataTemplate for certain cells. I need to access the DataContext of the root element (the one which is hosting the grid) so that I can access additional bindings to support my datatemplate. So you have: Window Window.DataContext = TheDataSourceWithIte...

.NET WPF XAML "BindingExpression path error: ... property not found"

I was trying to bind a collection of my W3CError type objects to a WPF ListView control. It was a nice little 13 line class... Class W3CError Public Type As ErrorOrWarning Public Line As Integer Public Col As Integer Public Message As String Public MessageId As String Public Explanation As String Public So...

ASP.Net MVC - strange params caching behaviour in Actions

I'm facing a strange problem in my project. My actions are getting old param values instead of the actual values which are in Request.Params. I created a HomeController.Echo(string text) action to illustrate it (see screenshot). When I call the action for the first time like "Home/Echo?text=aaa" everythink works fine. When I call the sam...

Spring - best way to deal with binding to a list of beans in a simpleformcontroller

Hello, Without thinking about it too much, I've been doing something like the following: 1) building a list of SomeBean objects based on the results of a database call 2) putting that list in my command object 3) building a form based on that command object where users can modify attributes of the SomeBeans 4) extracting data out of...

WPF Binding - How to determine object is invalid to prevent Save

Hi, I have a textbox in a WPF application bound to a property on a Linq to Entities class that implements IDataErrorInfo. The textbox binding has ValidatesOnExceptions=True and ValidatesOnDataErrors=True. When the textbox is bound to an integer property and the user enters text then the textbox outline displays as red as I haven't set...

Binding images to Image in Silverlight 2

I'm building a Silverlight 2 application and I need to bind some images to Image object declarated in XAML. I'm doing some other binding in the application and it works just fine, I'm having problem with only images! This is it's XAML: <Image Source="{Binding Path=ThumbNail}" Style="{StaticResource ThumbNailPreview}" /> And this is t...

Data Binding as a design pattern

Where can I find a discussion of the Binding in a way similar to GoF? ...

Java dynamic binding

I am practicing for an exam, and found a sample problem that gets me totally lost. For the following code, find what the output is: class Moe { public void print(Moe p) { System.out.println("Moe 1\n"); } } class Larry extends Moe { public void print(Moe p) { System.out.println("Larry 1\n"); } public v...

Is it possible, with the Python Standard Library (say version 2.5) to perform MS-SQL queries which are parameterized?

While the particular data I'm working with right now will not be user-generated, and will be sanitized within an inch of its life during my usual validation routines, I would like to learn how to do your basic INSERT, SELECT, etc. SQL queries while protecting myself against SQL injection attacks, just for future reference. I'd rather le...

Bypass model binders in asp.net MVC for complex action parameters?

Is there an attribute that can turn off model binding for complex action parameters? My scenario is this: I'm using Linq to SQL but make the generated classes implement interfaces. For example, IUser. Some of my controllers actions accept IUser parameters and some of my views bind IUser models, but I don't want the default model binder ...

ProgressBar not updating on change to Maximum through binding

<ProgressBar Foreground="Red" Background="Transparent" Value="{Binding NumFailed, Mode=OneWay}" Minimum="0" Maximum="{Binding NumTubes, Mode=OneWay, Converter={x:Static wpftools:DebuggingConverter.Instance}, ConverterParameter=Failedprogressbar}" FlowDirection="RightToLeft"...

Maintain Selection State After Changing Backend Collection in ListView

I have a listview control that is bound to an observable collection that I frequently update. When I update the collection, I clear the collection and then add the values. While this is a bit overkill for simple changes, it's very simple and accomplishes the job. In doing so, I lose which item was selected in my listview control and cann...

Is it possible to 'refresh' WPF data bindings

I've got a xaml TabControl and on one page, there are 3 RadioButtons each bound to a different property on the selected value of an adjacent ListView. After switching between selected items in the ListView, my radio buttons seem to forget they're bound and don't refresh. So watching it in the debugger, when I switch to a new selected it...

Refactor XAML code with binding

I try to refactor such XAML by introducing new user control: <Window ...> <ComboBox ItemsSource="{Binding Greetings}" /> </Window> After adding a control I have ControlA XAML: <UserControl ...> <ComboBox ItemsSource="{Binding Items}" /> </UserControl> ControlA C#: public static readonly DependencyProperty ItemsProperty = Wp...

WPF: Aggregating properties on a ListBox

I have two ListBoxes, both use Extended SelectionMode. The ItemsSource of the first is a List, and uses a datatemplate. I'm trying to use an aggregation of some property from the first as the itemssource for the second. For example: public class MultiAppPropertyAggregator : IValueConverter { public object Convert(object value, T...