binding

How to disable binding of the route values in ASP.NET MVC?

As I know ValueProviderDictionary takes values for binding from 3 places From Post form From Route values From Query string I want to be able to disable the second and the third options. The only solution I see here is to create my own custom ValueProvider (copy-paste ValueProviderDictionary source file and remove these two options f...

How can I get the binding from method_missing?

I am trying to find a way to get the binding from the caller within method_missing in Ruby (1.8), but I can't seem to find a way to do it. Hopefully the following code explains what I would like to do: class A def some_method x = 123 nonexistent_method end def method_missing(method, *args, &block) b = caller_binding ...

XAML Binding.UpdateSourceTrigger when a Button.Click is fired?

Hi I want to set the UpdateSourceTrigger to an event of a control: <TextBox Text="{Binding Field, UpdateSourceMode=btnOK.Click}"> <Button Name="btnOK"> <Button.Triggers> <Trigger> <!-- Update source --> </Trigger> </Button.Triggers> </Button> I thought about two ways: Set UpdateSourceMode or some...

How to use UpdateSourceTrigger=Explicit in an Items control like ListBox etc.

Hi! I have a ListBox that each of its items has a button, I set all the textboxes in the dataitem that the Binding.UpdateSourceTrigger is Explicit. I added a handler to the button's click, now what? How do I collect the info from the controls? they don't have a key they are dynamic, how do I get their BindingExpressions? <ListBox Ite...

Simple WPF RadioButton Binding?

What is the simplest way to bind a group of 3 radiobuttons to a property of type int for values 1, 2, or 3? ...

.Net Application-wide variables

I'm fairly new to .Net... I have several queries which will execute when the application loads. I want these queries to store the data in an object (a dataset?) which is accessible throughout the application. Should I be using a singleton class? How can a User Control within my application reference public variables in the main applicati...

asp.net mvc view with masterpage binding with different models

if i have a master page that binds with ObjectA and then a View that binds with ObjectB, how does that work (or does it work at all) in asp.net mvc. master page might have: Inherits="System.Web.Mvc.ViewMasterPage<CalendarEvent[]>" %> and one of the view might have: Inherits="System.Web.Mvc.ViewPage<Tournament[]>" %> what would you...

[WPF] RelativeSource FindAncestor issue

Here is the code: <GridViewColumn DisplayMemberBinding="{Binding Path=BookId}" Width="100"> <GridViewColumn.Header> <Border BorderBrush="Black"> <TextBlock Width="{Binding RelativeSource...

Bind page title to a text block in a style

OK, I have defined a style for Navigation Window. I have successfully styled Navigation buttons and even added page breadcrumbs to the Navigation menu. What I want is to add Page title next to the breadcrumbs: Style x:Key="{x:Type NavigationWindow}" TargetType="NavigationWindow"> <Setter Property="SnapsToDevicePixels" Value="true"/>...

What's the point for UpdateModel to take values from RouteData and QueryString?

I've asked here about how to remove RouteData and QueryString sources from ValueProvider. And this question came out: When does the UpdateModel needs values from RouteData and QueryString? Why this is left as default feature? I see point to use RouteData and QueryString to call the correct controllers methods and provide parameters for ...

C# databinding on combobox

Hello, I can't understand the following 2 issues given this code. I mapped a combobox to a custom object and I want each time that the selected value change on the combobox, the custom object changes too. public partial class MainForm : Form { private Person _person; public MainForm() { InitializeComponent(); ...

ListView Binding refresh suggestion in WPF

I have an ObservableCollection bound to a list box and have a highlight mechanism set up with data triggers, when I had a simple set of highlighters (debug, warning, etc) I could simply enumerate the style with several data-triggers bound to the view model that exposes those options. I have now upgraded the system to support multiple us...

Value Converter Without Binding On Image Source

Hi, I need to get the path of an image through a value converter. However I can't find any examples of using a value converter without binding. I would be looking to do something along these lines: <Image source="{Value=Image1, Converter={ImageConverter}}" /> The image converter will then go check an image folder and return the corr...

How to bind control's two properties to two object properties properly

I have a Form with TextBox on it like this: Form f = new Form(); TextBox t = new TextBox (); t.Click += new EventHandler(t_Click); t.LostFocus += new EventHandler(t_LostFocus); Testus tt = new Testus(); t.DataBindings.Add("Left", Testus , "X"); t.DataBindings.Add("Text", Testus ,...

What is the best way to bind decimal / double / float values with PDO in PHP?

It appears the class constants only cover PDO::PARAM_BOOL, PDO::PARAM_INT and PDO::PARAM_STR for binding. Do you just bind decimal / float / double values as strings or is there a better way to treat them? MySQLi allows the 'd' type for double, it's surprising that PDO doesn't have an equivalent when it seems better in so many other way...

Parameter binding using GQL in Google App Engine

Okay so I have this mode: class Posts(db.Model): rand1 = db.FloatProperty() #other models here and this controller: class Random(webapp.RequestHandler): def get(self): rand2 = random.random() posts_query = db.GqlQuery("SELECT * FROM Posts WHERE rand1 > :rand2 ORDER BY rand LIMIT 1") #Assigning values for Django templa...

XAML - Binding to DataContext and using converter?

To bind to the current DataContext in XAML you can use: <TextBlock Text="{Binding}" /> How do you do this using a converter in the mix? The following works when you have a property on the path: <TextBlock Text="{Binding MyProperty,Converter={StaticResource converter}}" /> But I dont want to do that; I just want to Bind to the datac...

How to inform binding that property value has changed?

I have a class with a int property called X. I binded it to Left property of a textBox. But when I change my class X value, textBox does not move. What to do to inform binding that my property value has changed so that textBox will move right? ...

What to do so that TextBox Left change will update X value of binded class?

I have a TextBox and I change it's Left value. And this TextBox is bound to a class that have X property. Now when I change Left value of my TextBox I would like to have X of my class updated. What should i do to force update of my databound class property? ...

wpf: how to make ComboBoxItems hold integers in xaml

ok, I must be having a brain freeze here... I have a ComboBox with 6 items and I'm trying to bind the selected item to an integer value. Its not working, I suspect its because the ComboBoxItem's are strings. I don't feel like making a list in code behind just to fill this little box, so is there a way in xaml to tell the comboboxitems t...