databinding

Limit the number of results in a Nested ASP.NET ListView

Similar to my other question: I have a ListView bound to a Dictionary. Then I have a nested ListView for the dictionary's value's integers. I need to limit the number of items bound to the nested list to something like 5, and show a more button in the template. I can't find a way to get the more button to work, and to correctly limit...

[WPF] Custom binding class is not working correctly

Hi! Currently I'm playing around with WPF data binding and I came to an issue I dont understand. So I post the problem here, maybe you have and idea whats geoing wrong. At first: I'm working with Visual Studio 2008 under Windows Vista 32bit, the problem is also present in Windows 7 RC1 64bit, latest updates/service packs are installed e...

Catch error in GridView automatic databinding

I have a gridview with a DataSourceID set, so the databinding happens automatically. The problem is that sometimes, the procedure defined in the SqlDataSource takes a very long time to finish, so the binding comes with a timeout expired error. How can I catch this error without manually databinding the gridview and surrounding it with t...

Binding files from ClientBin folder into a ComboBox in Silverlight?

Hello all, I was wondering if it was possible to bind some filenames in a given directory of the ClientBin folder to a ComboBox. I'm working on this application that has a video Tutorials section. I've got a comobox that lets the user select which tutorial video they wish to see. Right now not all the videos are completed (it's a bit...

WPF Databinding and Styling based on Data in an item in an IList

I have a ListBox bound to a list of Items (for arguement, lets say its got a string and two dates Entered and Done). I would like to make the background color of items in the ListBox have a gray color if the Done DateTime is != DateTime.MinValue. Edit: Should I make a converter? and convert DateTime to a Brush based on the value of th...

ADO.NET Data Service not dynamically updating

My application is a client/server solution using an ADO.NET Data Service. The Data Service exposes transactionSummaryData as follows: public IQueryable<TransactionSummary> TransactionSummaries { get { return MainForm.transactionSummaryData.Items.AsQueryable(); } } The transactionSummaryData is of type TransactionSummaries whose it...

Silverlight databinding selection?

Can anyone explain how silverlight/wpf databinding actually determines which is the right item to set as the selectedItem in a collection as in the following snippet <ComboBox SelectedItem="{Binding Mode=TwoWay, Path=Province}" ItemsSource="{StaticResource ProvinceCollection}" /> Where ProvinceCollection is simply a static...

If DataKeyNames is set to a field not defined as a primary key, then…

Hello, 1) I noticed that if I set GridView.DataKeyNames to a field that actually isn’t defined as primary key in data source, data source control ( or perhaps GridView?) will somehow know that field set in DataKeyNames isn’t really a primary key. I became aware of that fact when I opened Configure the Select Statement window ( via G...

Use a property trigger to change a property that already has a binding.

How can I use a property trigger in a style (or another method) to change a property (ToolTip for example) that already has its value defined by a binding? I have a simple button like so: <Button Name="Button1" Style="{StaticResource ButtonStyle}" ToolTip="{Binding Name}" >My Button</Button> It has a binding on the tooltip t...

asp.net and jQuery problem: Client elements don't get updated when the form is posted back

I have a web form that contains lots of JavaScript functionalities to manipulate the DOM. This is achieved using AJAX to call a service that will return me whatever I have to do, such as hiding elements, cascading drop downs, removing and inserting new items to a select, etc. Everything works as expected apart from one particular functi...

In databinding, how to find which control invoked the "getter" of a property data-bound to it, when the PropertyChanged event is raised?

Hi, I am developing a Silverlight 3 application, in which I have a boolean property in my Model class (using MVVM approach) that's bound to "IsEnabled" target property of two buttons. I need to find out which button invoked this boolean property when I raise the PropertyChanged event (i.e. during databinding). Is there something in the...

How can I tell my DataTemplate to bind to a property in the PARENT ViewModel?

I've got the following MainView.xaml file that works well as a MVVM menu switcher. I've got these pairs: Page1View / Page1ViewModel Page2View / Page2ViewModel in my MainViewModel I fill an ObservableCollection with both ViewModels, then when the user clicks the Next button, it calls NextPageCommand in MainViewModel which switches out...

How do I remember a WPF XmlDataProvider bound Treeview's IsExpanded property when refreshed?

I have a WPF treeview that is databound to an XmlDataProvider - the XML source is used by many PCs. When the XmlDataProvider is refreshed all the TreeViewNodes collapse. I would like each PC to remember the status of the IsExpanded attribute. I understand that I could add an IsExpanded property to the XML, however then this would be u...

How can I make a function that can take a SQLDataReader and a DBDataRecord as a parameter?

I have a function that is normally called while looping inside a SqlDataReader, that will take data from that SqlDataReader and do some stuff with it. Now, I need to be able to also call it from inside a Data Bound Repeater object, that is also bound to a SqlDataReader... In the DataBound control, in the "OnDataBinding" event, I normal...

Where did my insert row go? (DataGridView)

I am using a Datagridview (unbounded mode) and I have selected "enable adding" in the designer. when the form loads, the grid is not populated (drop down to select a supplier and button to view aliases) and there is a single row displayed with the * in the tab. However, when I populate the grid, I no longer have this insert row for ad...

.NET: How to change the value in a DataTable

In ADO.NET i'm using GetSchemaTable to return the schema table for a results set. DataTable schema = rdr.GetSchemaTable(); gridSchema.DataSource = schema; gridSchema.DataBind(); Unfortunatly the "ProviderType" value is displaying as an integer, rather than the OleDbType enumeration value that it is: ProviderType Desired Display ...

DropDownList get underlying object

I have an DropDownList bound to an ObjectDataSource. when I select a row in the drop down how do I get the underlying object(not just the value or text properties). I'm trying to add the selected object from the DropDownList to a Listbox's datasource but I don't know how to reference the object picked. The objects aren't backed in a data...

Excluding Item from DataList

In onItemDataBound event of the ListView I am checking the data and under certain condition I dont want this item to be part of the DataList. If I make it invisible it will still be accounted for in DataList. It will just be invisible and the sepatators and its place in tilibg will still be there. Is there way to exclude the item from ...

How do I properly add a prefix (or suffix) to databinding in XAML?

How do I databind a single TextBlock to say "Hi, Jeremiah"? <TextBlock Text="Hi, {Binding Name, Mode=OneWay}"/> Looking for an elegant solution. What is out there? I'm trying to stay away from writing a converter for each prefix/suffix combination. ...

Changing C# datalist item programmatically

I have a datalist i want to programmatically run some checks and then change the text that is been displayed. Can this be done ? Any examples? ...