databinding

How can a hashtable be bound to a drop down list?

In vb.net / winforms, how can a hashtable be bound to a drop down list or any other datasource-driven control? ...

Using extension methods within inline databinding context

I'm trying to use some extension methods that I use to apply consistent formatting to DateTime and Int32 - which works absolutely fine in code behind, but I'm having issues with databinding. I get: 'System.DateTime' does not contain a definition for 'ToCustomShortDate' for <%# ((ProductionDetails)Container.DataItem).StartDate.ToCust...

WPF DataContext Binding and Refresh

My scenario is: I have a WPF Window with 3 data-bound text boxes SettingsUI : Window <Grid Name="SettingsUIGrid1"> <TextBox Text="{Binding Path =val1}" .... <TextBox Text="{Binding Path =val2}" .... <TextBox Text="{Binding Path =val3}" .... </Grid> In the constructor I do this: SettingsUIGrid1.DataContext = coll[0]; // collection f...

workarounds for nameof() operator in C#: typesafe databinding

There's been a lot of wishes to include nameof () operator in C#, so that you could do, for instance, nameof (Customer.Name), which will return you "Name". I have a domain object. And I have to bind it. And I need names of properties as strings then. And I want them typesafe. I remember, there was a workaround for .NET 3.5 which involv...

WPF - How can I selectively set the "Visibility" of a TabItem via DataBinding/Triggers

I have a tab page that should be hidden if a property (BlahType) is set to 1 and shown if set to 0. This is what I WANT to do: <TabItem Header="Blah"> <TabItem.Triggers> <DataTrigger Binding="{Binding BlahType}" Value="0"> <Setter Property="TabItem.Visibility" Value="Hidden" /> </DataTrigger> </TabItem.Triggers> ...

Getting data from a checkbox inside a template column of asp.net gridview

This seems like something simple, but I can't seem to figure it out! I'm trying to get 2-way data-binding to work on an ASP.net page with a check box as one of the columns. How do I get the updated values (from check boxes) back from the gridview ????? Here is my data type: [Serializable] public class UserRequirements { public str...

WPF Binding Collection To ComboBox and Selecting an item

I've been knocking my head against this for some time now. I'm not really sure why it isn't working. I'm still pretty new to this whole WPF business. Here's my XAML for the combobox <ComboBox Width="200" SelectedValuePath="Type.FullName" SelectedItem="{Binding Path=Type}" Name="cmoBox" > </ComboBox> Here's what populates the ...

DropDownList.SelectedValue changes (as a child control in a FormView) aren't sticking

Okay, I have a FormView with a couple of child controls in an InsertItemTemplate. One of them is a DropDownList, called DdlAssigned. I reference it in the Page's OnLoad method like so: protected void Page_Load(object sender, EventArgs e) { ((DropDownList)FrmAdd.FindControl("DdlAssigned")).SelectedValue = ((Guid)Membership....

How to format a number string in gridview?

In C# I have a processing time number data column in the database which is in in this format "###" or "##" ( eg: "813" or "67") When I bind it to the grid view I wanted to display it in this format "0.###" (eg: "0.813" or "0.067") I tried using {0:0.000} and other formatings. But none seem to work. Can anyone tell me how to write the ...

Flex - Binding ViewStack selectedChild Property Using a String Value

The attached code example (pseudo code) compiles, but throws this Run-Time Error: TypeError: Error #2007: Parameter child must be non-null. at flash.display::DisplayObjectContainer/getChildIndex() at mx.core::Container/getChildIndex()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\Container.as:2409] at mx.containers:...

ASP.NET Custom Server Control (GridView), DataBinding, and Control Lifecycle conflict.

Hi, I have created a Custom Server Control (Inherited from GridView). On the page, the GridView is DataBound to a DataSet, so I do not know at design time what columns will be present in my GridView. Now, what I want to do is, to add a textbox in every Cell for the GridView Header row, and those textboxes will control column filtering...

Two-way binding in WPF

I cannot get a two-way bind in WPF to work. I have a string property in my app's main window that is bound to a textbox (I set the mode to "TwoWay"). The only time that the value of the textbox will update is when the window initializes. When I type into the textbox, the underlying string properties value does not change. When the string...

How do I bind a WPF DataGrid to a variable number of columns?

My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used to apply formatting. A simplified version of the output might be something like: class Data { IList<ColumnDescription> ColumnDescriptions { get; set; } strin...

.NET Databinding ignores property change

I have written a control in C# that derives from System.Windows.Forms.Control. I have added a property Selected to which I want to databind to a business entity using a BindingSource. I’ve implemented the PropertyNameChanged pattern by adding a SelectedChanged event that I fire when the Selected property is changed. This is my code: p...

How does binding in ActionScript work?

As far as I understand, binding to a var in ActionScript is carried out via events which are automatically fired when a var is changed. I have a few questions about this: What happens if the class doesn't explicitly extend EventDispatcher? Is there is some sort of magic that goes on in the compiler which essentially makes the class an ...

How do I get rid of the red rectangle when my wpf binding validation has failed and the containing panel is no longer visible?

I have a situation where I am using wpf data binding and validation using the ExceptionValidationRule. Another part of the solution invovles collapsing some panels and showing others. If a validation exception is set - i.e. the UI is showing a red border around the UI element with the validation problem, and the containing panel is col...

Databind a value to a gridviewcolumn header?

Is it possible? I have a listview with several gridviewcolumns. The last column has a dynamic header. I dont know what the column header will be at design time. It's actually a number I want to display as a string. <GridViewColumn Header="{Binding Path=SomeValue}" DisplayMemberBinding="{Binding Path=OtherValue...

How do I refresh an ASP.NET ListView using jQuery and AJAX?

I have a page with a number of ListViews that I want users to be able to sort and page through. Rather than postback and rebind the entire page each time, I would like to do it via jQuery/AJAX selectively for the control in question. I am comfortable making the client-side call to a WebMethod in my page - my question is how do I get the ...

WPF: Check/Uncheck all checkbox for checkboxes located in gridview cell template?

I'm trying to create a check/uncheck all CheckBox for a number of CheckBoxes that are located inside the cell template of a GridViewColumn. I added this column to a GridView (along with other columns), set the GridView to the view property of a ListView, and then databound the ListView to a collection of custom DataObjects. So, each row ...

How can you two-way bind a checkbox to an individual bit of a flags enumeration?

For those who like a good WPF binding challenge: I have a nearly functional example of two-way binding a checkbox to an individual bit of a flags enumeration (thanks Ian Oakes, original MSDN post). The problem though is that the binding behaves as if it is one way (UI to DataContext, not vice versa). So effectively the check box does ...