databinding

Can't find control in edit mode in DataList

private void BindDataList() { int userId = Convert.ToInt32(ProfileInfo.GetUserID()); DataList1.DataSource = CatalogAccess.GetAddressByUserID(userId); DataList1.DataBind(); foreach (DataListItem item in DataList1.Items) { Label lbl = (Label)item.FindControl("lbl"); lbl.Text ...

Binding to a data template control property

Is it possible to bind something to a property of a control in a data template entirely in XAML? The following code is a simplified version of the problem I'm running into. I'd like the text of the TextBlock (displayName) to be updated as the user types in the TextBox located in the DataTemplate. <Window x:Class="WpfApplication4.Window1...

How to programmatically hide a linq-to-sql column on a datagridview?

I'm binding a linq Query to a datagridview for the purposes of allowing a user to insert/update/delete. However I'd like to hide the Id column. but I'd rather not hard code the datagridview.columns[id].visible=false In the event the id column name changes. I've read that you can walk through reflection to get a run-time list of colum...

Binding from within a DataTemplate?

I'm building a Silverlight control and I'm trying to set up bindings for the Header and Body ContentControls through their respective DataTemplates. I'm not sure why, but this does not work (silently fails). My only guess is that it is because the DataTemplates are StaticResources. Can anyone offer advice? The control has the followi...

WPF ObjectDataProvider IsAsynchronous Complete and conditional databinding

Kind of a two part question... first let me explain what I am trying to accomplish. I have a basic window that is laid out as follows Server (combobox) that pulls a list of sql servers: <ObjectDataProvider x:Key="SQLServerList" ObjectInstance="{x:Static data:Sql.SqlDataSourceEnumerator.Instance}" MethodName="GetDataSources" IsAsynchro...

adding sql query output to hyperlink in asp.net

I think it might have been asked before but i was unable to find the right answer, so i am asking here. i have added a data source which is working fine, i wanted a feature where i query the top n entries from the database and add it with a hyperlink. Think of it like Latest News! The markup for the hyperlink inside the ItemTemplate of D...

editing and updating data in datagridview with Windows Forms Application

I have added a datasource and a datagridview in a windows forms application. I am able to view the data from my database on to the grid, however when i try to insert new row (by clicking on the empty row) or try to edit the existing data it doesn't reflect in my database. I remember we do not have to add any manual code to achieve such a...

WPF : CollectionViewSource displaying grouped by Property

In Xaml, suppose I have a CollectionViewSource who's source is set to observable collection of objects of type Order: public class Order { public int ContractID { get; set; } public double? Price { get; set; } public OrderSide Side { get; set; } } public...

How to bind a Child collection element to a Parent command class through addChild convenience method (Spring MVC)

Hi, I have a domain class named Parent as follows public class Parent { public List<Child> childList = new ArrayList<Child>(); public void setChildList(List<Child> childList) { this.childList = childList; } public List<Child> getChildList() { return childList; } public void addChild(Child ch...

General Observable Dictionary Class for DataBinding/WPF C#

Hello, I'm trying to create a Observable Dictionary Class for WPF DataBinding in C#. I found a nice example from Andy here: http://stackoverflow.com/questions/800130/two-way-data-binding-with-a-dictionary-in-wpf/800217 According to that, I tried to change the code to following: class ObservableDictionary : ViewModelBase { public O...

Why do I need to bind GridView on every postback to make click events from columns to work

Ok, i have a gridview and on page load, i dynamically add a column to it that contains a link control. this link control has a onclick event associated with it so that when its clicked, i want to do some processing. Now I have noticed that if I just bind the grid the first time (i.e. if(!IsPostBack) and have enableviewstate for the grid ...

Winforms data binding: Custom classes or datatable?

Hi guys, Am in the process of architecting a new windows forms application, and I intend to use Visual Basic 2008 and SQL Server Express 2005. This is my first application in .Net and I really want to observe the best OOD & OOP principles to create an application that is easy to maintain and extend (add new functionality). My issue is i...

C#/WPF: Get Selected Row from a ListView

Hello, I've following ListView Item (in a WPF Form): <ListView Name="listViewTeam" ItemsSource="{Binding Path=TeamList}"> <ListView.View> <GridView ColumnHeaderTemplate ="{StaticResource BlueHeader}"> <GridView.ColumnHeaderContainerStyle> <Style TargetType="{x:Type GridViewCol...

Simple way to bind radiobuttons to SQL table in C#

Hello, I'm trying to bind an SQL table to radiobuttons in a windows form application. The buttons are grouped by groupboxes. I haven't yet find a way to bind them correctly to the datasource. I know some had managed to do this by creating a custom control but I wonder if there is a simpler way? ...

.NET / C# Binding IList<string> to a DataGridView

I have an IList<string> returning from a function (as variable lst) and I set and then I this.dataGridView1.DataSource = lst; The datagrid adds one column labelled Length and then lists the length of each string. How do I make it just list the strings? ...

How can I append text to a databound field?

If I have this: <img ID="imgField" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem,"Name") %>' /> How can I add "images/" or any other string add on to the url? I tried ImageUrl=' "images/" + <%# DataBinder.Eval(Container.DataItem,"Name") %>' And ImageUrl= "images/" + '<%# DataBinder.Eval(Container.DataItem,"Name"...

Adding Item to DataBound Drop Down List

Yes, I have read most of the topics here, but I can't find an answer that works. I have Three drop-down lists. The first is databound to grab distinct experiment names. The user selects, page posts back, and the second drop-down menu displays distinct time points. This is where I need help. I need to add an item to THAT drop-down list w...

Working with data and a JTable?

I have a JTable that I want to use to display some data (a String and a Boolean in each row). The data is maintained by my own class. Is there some way to bind the data model to the JTable, so that when I add to the model, the JTable is dynamically updated and when I remove something from the model, the row is removed from the JTable? I...

Some Problem with WPF Databinding but You Have to Guess What Kind

I'm trying to implement a property changed event (or which ever is appropriate) in my wpf project and I'm trying to find the best way to do this. I have this header where it has an expand/collapse icon and in my window, I might have multiple headers. I want the default to be collapsed when all headers are listed in the beginning but whe...

ASP.NET User control, databinding DataTable

Hi, I got a user control containing a form. On a page that includes the user control, I need to populate the form in the user control, when the user pushes a button. Heres how I've done it, and it doesn't work: User Control: public partial class editUC : System.Web.UI.UserControl { public DataTable dataTable { set { UpdateForm(va...