databinding

Weird behaviour with Chrome browser and data bound button.

I've noticed some strange browser specific weirdness with Google Chrome with some data bound buttons, in that when you navigate away from the page then use the browsers back button the data bind displays different data. If you then hit refresh it resets to the correct data. It doesn't happen in Firefox or Explorer 7. I had actually ente...

How to separate the selected item of two combobox with a single DataSource?

On a form, I have two combobox wich have the same DataSource (their elements list are the same). When the user select an item in one of the control, the other control's selected item is also modified. That's not what I want. I'd like to have both list populated with the same DataSource (as I currently do), but I'd like their selected it...

How to prevent a combobox first item from being selected on DataSet.Merge()

Hi, I've got a ComboBox which items are coming from a DataTable in a DataSet. When there is no item selected (combo.selectedindex = -1) and I do a .Merge() on the DataSet the first element of the combobox is selected. When there is an item already selected, the item stay selected. How can I prevent this and make it so that even if I do...

Bind to ancestor of adorned element

Hi there! Here is the case: <DataTemplate x:Key="ItemTemplate" DataType="local:RoutedCustomCommand"> <Button Command="{Binding}" Content="{Binding Text}" ToolTip="{Binding Description}"> <Button.Visibility> <MultiBinding Converter="{StaticResource SomeConverter}"> ...

How to bind a TabControl to an ObservableCollection in XAML

I have the following line of code in my code-behind class. TabControl.ItemsSource = ((MainWindowViewModel)DataContext).TabItemViewModels; I would like to move this to the XAML file. In brief, There is a MainWindow class representing the main-window. There is a TabControl placed on the main-window. There are 2 view-models called Mai...

asp.net passing string variable to a user control

Hi all, I am trying to pass value of a code behind variable to a user control like: <pv1:ShowPdf ID="ShowPdf2" runat="server" BorderStyle="Inset" BorderWidth="2px" FilePath='<%=path2%>' Height="700px" Width="856px" /> where path2 is a protected string variable declared in code behind. The problem is that the value of path2 ...

Updating my table's datagridviewcomboboxcolumns directly.

Hello community, [Note : I've simplified my example for clarity] Let's say that I have a Sqlite database with two tables: Items and Sectors: Items: id_items : INTEGER PRIMARY KEY name_item : VARCHAR(...) id_sector : INTEGER Sectors: id_sector : INTEGER PRIMARY KEY name_sector : VARCHAR(...) I currently have a datagridview that i...

WPF itemscontrol binding to collection of controls

Hi, I'm trying to bind to a collection of controls I generate dynamically: <ItemsControl ItemsSource="{Binding CustomFields}"> And the code: public ObservableCollection<Control> CustomFields { get { return GetCustomFields(); } } The Getcustomfields just generates some controls like a...

Bind WPF DataGrid ItemsSource to method, IEnumerable<TableRow> GetRows(), of custom Table object?

I am struggling with the learning curve on WPF data binding and could use an example. Bonus points for those that answer the question and link to an article that helped them "get" WPF data binding. I am trying to bind a custom Table object with a WPF DataGrid. Here is my objects (I do not have the ability to change them, signatures tr...

Nested ListViews in ASP.NET

I am nesting 3 listviews. I use the itemdatabound event to find my second listview to bind to. My question is how do I find the third listview. How do I access the itemdatabound of the second listview to then find the third control. Hope that makes sense Thanks EDIT: Can someone point me to a good example or tutorial on how to do th...

How to bind dataGridView predefined columns with columns from sql statement (without adding new columns)?

Hey, Is there a elegant way, to bind predefined dataGridView columns with results from sql statement? Example: dataGridView1.Columns.Add("EID", "ID"); dataGridView1.Columns.Add("FName", "FirstName"); some sql like SELECT t.FirstName as FName, t.EmpID as EID FROM table t ... and then I call dataGridView1.DataSource = someDataSet.Tab...

ASP.NET DataSource Control "does not have a naming container" exception

I've been getting this exception in my code and wondered if anyone could help me out. I have a Repeater Control bound to an ObjectDataSource, and the itemtemplate for the repeater contains a User Control (ASCX). This user control in turn contains several other controls, mainly a GridView that is associated with an ObjectDataSource. On...

Inline Data-Binding asp.net tags not executing

My problem is I used to be able to do this, < div runat="server" visible='<%#CallAFunctionThatReturnsBoolean() %>' > and CallAFunctionThatReturnsBoolean() will be called in Page_Load when the control's DataBind function gets called implicitly and the div's visibility will be set correctly. Now for some reason this doesn't happen anym...

How to call Eval in codebehind?

How the heck do I call Eval() from codebehind? I know this is a front-end shortcut for something like DataBinder.Eval(Container.DataItem, "name"), but I cannot get this damn thing to compile. I am missing the proper method parameters, I think. I want to turn something like this: <asp:Image ID="imgLogo" runat="server" ImageUrl='<%# Ev...

How can I bind a command of a control in template to my ViewModel

Hi guys, Right, what I have is: <Window x:Class="WpfGettingThingsDone.View.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" AllowsTransparency="True" Background="Transparent" WindowStyle="None" Title="{Binding Title}" Height...

Using DataAnnotations for validation in MVVM

Hi, I've discovered the new data annotation features of SL3 and I'm using them for user input validation. I've got inputs like these: <dataInput:Label Target="{Binding ElementName=inputName}"/> <TextBox x:Name="inputName" Text="{Binding RequestDemoData.Name, Mode=TwoWay, Valid...

WPF synchronize Listview with some ViewCollection

hi there, I have a WPF Listview databound to an ObeservableCollection named "FilteredAppendixes". Now I create a view with: CollectionViewSource.GetDefaultView(FilteredAppendixes); The currentItemProperty of it will not be in sync with the Item I choose by Mouseclick in the listview. the CurrentITem property always remains the same fi...

Silverlight Datagrid RowEditEnded

I have a SL DataGrid that has two columns. I need to be able to catch any change to the a row and save it into an undo stack. I setup the event RowEditEnded and tried to add to the undo stack there. The problem I'm running into is that I have no way to get the new value from RowEditEnded. If the column is a ComboBox then it updates t...

WPF TabControl add extra tabs to a bound control

Hello, I have a Tab Control with a ItemsSource Binding. ... I want to add a predefined tab to the front called All that has an aggregate of all the other tabs, and I would also like to add a button at the end called Add so I can add a new tab. Is there an easy way of doing this ? Thanks, Raul ...

Databinding ObjectDataSource inner List<T> property with Gridview

Hi Everyone, I have a Nhibernate Repository which I use with a Object DataSource to bind Job Objects (shown below) to various controls on a Asp.Net page. So far I've not had any problems binding, until I wanted to bind the inner IList of Tasks contained in the Job Object: Specifically I want to bind the Tasks list to a Gridview, So ...