470,848 Members | 1,887 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

textBox DataBindings not working?

In my code I create a sqlDataAdapter that which contains a simple
select command using the Northwind DB (SELECT top 15 customerID,
companyName, contactName, contactTitle From Customers). I populate the
dataSet using the fill and bind the dataset to a datagrid. I then bind
a text box control to a field on my dataset. When I move around the
datagrid my textbox control values does not change. It the value stays
on the first record. If anyone could provide any suggestions as to
what I'm doing wrong I would greatly appreciate it.

this.daNorthWind.FillSchema(this.dsCustomer,Schema Type.Source,
"Customers");
this.daNorthWind.Fill(this.dsCustomer,"Customers") ;
this.dataGrid1.DataSource = new
DataView(this.dsCustomer.Tables["Customers"]);

this.txtCustomerID.DataBindings.Add("Text",this.ds Customer.Tables["Customers"],
"customerID"

Thanks

Feb 19 '06 #1
2 3121
Hey jose,

The way you are trying to present data does not work in web environment..
say you display 100 items in datagrid and you bind customer id to textbox
and you wish to display id in textbox for each client side move.. does not
work. Can you tell how did you move around with your datagrid? did you click
on any button?

Hope this would clarify..

"jo***********@gmail.com" wrote:
In my code I create a sqlDataAdapter that which contains a simple
select command using the Northwind DB (SELECT top 15 customerID,
companyName, contactName, contactTitle From Customers). I populate the
dataSet using the fill and bind the dataset to a datagrid. I then bind
a text box control to a field on my dataset. When I move around the
datagrid my textbox control values does not change. It the value stays
on the first record. If anyone could provide any suggestions as to
what I'm doing wrong I would greatly appreciate it.

this.daNorthWind.FillSchema(this.dsCustomer,Schema Type.Source,
"Customers");
this.daNorthWind.Fill(this.dsCustomer,"Customers") ;
this.dataGrid1.DataSource = new
DataView(this.dsCustomer.Tables["Customers"]);

this.txtCustomerID.DataBindings.Add("Text",this.ds Customer.Tables["Customers"],
"customerID"

Thanks

Feb 20 '06 #2
I did this sample on a win. form. app. I also noticed when I re-wrote
the datasouce assignment to only include the dataset (no dataview) it
worked correctly (see below)? Q: when i assign a dataview to the
datasource if I want to get the current values for a row do I have to
use the concurrency obj?
,,,
this.dataGrid1.DataSource = dsCustomer
this.txtCustomerID.DataBindings.Add("Text",this.ds Customer.Tables["Customer*s"],

"customerID"

Feb 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Scotty | last post: by
2 posts views Thread by Dustin Davis | last post: by
3 posts views Thread by Randy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.