I have several textboxes that I need to chang the text when the selection row
is changed in a datagrid. I have the following code. This textbox displayes
the initial selection but when I click on different rows in the datagrid, the
textbox content doesn't change to reflect the change. How can I address
this?
Also, If the user change the text in the textbox then how do I refesh the
display in the datagrid to reflect the changes?
Thanks, Alpha 6 3296
Alpha,
It seems like you either have separate binding contexts, or that you are
binding to different data sources. First off, are the textboxes and data
grid in the same form? If not, then you have to create a binding context
and have the forms share it.
Second, how are you setting the data source in the bindings and the data
source in the grid? If you have a data set with a table, "Table", for
example, the following two are NOT the same:
dataGrid.DataSource = dataSet;
dataGrid.DataMember = "Table";
// Is not the same as.
dataGrid.DataSource = dataSet.Tables["Table"];
Also, are you using any views, by chance? Are you binding to different
views?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:0E**********************************@microsof t.com... I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this?
Also, If the user change the text in the textbox then how do I refesh the display in the datagrid to reflect the changes?
Thanks, Alpha
VListing is the datagrid and it's datasource is a dataset table:
VListing.SetDataBinding(dsVehicle, "VehDetail");
The textbox is only bind to the datagrid through the same dataset table:
txtVName.DataBindings.Add("Text", dsVehicle.Tables["vehDetail"], "VName");
I don't have any view created for this. These controls are all on the same
form.
Thank you, Alpha
"Nicholas Paldino [.NET/C# MVP]" wrote: Alpha,
It seems like you either have separate binding contexts, or that you are binding to different data sources. First off, are the textboxes and data grid in the same form? If not, then you have to create a binding context and have the forms share it.
Second, how are you setting the data source in the bindings and the data source in the grid? If you have a data set with a table, "Table", for example, the following two are NOT the same:
dataGrid.DataSource = dataSet; dataGrid.DataMember = "Table";
// Is not the same as. dataGrid.DataSource = dataSet.Tables["Table"];
Also, are you using any views, by chance? Are you binding to different views?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:0E**********************************@microsof t.com...I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this?
Also, If the user change the text in the textbox then how do I refesh the display in the datagrid to reflect the changes?
Thanks, Alpha
Alpha,
That is the problem. You are binding to dsVehicle.Tables["vehDetail"]
in the bindings, and to the data set in the vlisting.
Change the code to set the data bindings in the VListing to:
VListing.SetDataBinding(dsVehicle.Tables["vehDetail"], null);
And it should work.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com... VListing is the datagrid and it's datasource is a dataset table: VListing.SetDataBinding(dsVehicle, "VehDetail");
The textbox is only bind to the datagrid through the same dataset table: txtVName.DataBindings.Add("Text", dsVehicle.Tables["vehDetail"], "VName");
I don't have any view created for this. These controls are all on the same form.
Thank you, Alpha
"Nicholas Paldino [.NET/C# MVP]" wrote:
Alpha,
It seems like you either have separate binding contexts, or that you are binding to different data sources. First off, are the textboxes and data grid in the same form? If not, then you have to create a binding context and have the forms share it.
Second, how are you setting the data source in the bindings and the data source in the grid? If you have a data set with a table, "Table", for example, the following two are NOT the same:
dataGrid.DataSource = dataSet; dataGrid.DataMember = "Table";
// Is not the same as. dataGrid.DataSource = dataSet.Tables["Table"];
Also, are you using any views, by chance? Are you binding to different views?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:0E**********************************@microsof t.com... >I have several textboxes that I need to chang the text when the >selection >row > is changed in a datagrid. I have the following code. This textbox > displayes > the initial selection but when I click on different rows in the > datagrid, > the > textbox content doesn't change to reflect the change. How can I > address > this? > > Also, If the user change the text in the textbox then how do I refesh > the > display in the datagrid to reflect the changes? > > Thanks, Alpha
Hummmm, like magic, it's working just great! I don't quite understand. I
followed the databinding sytax for the datagrid, to put datasource as dataset
and the datamember as the table. You have it all specified in the
datasource.
So I guess the textbox binding only looks at the datagrid's datasource and
not the datamember, is that correct? And that's the source of my problem?
Hummmm.... Thank you so much. I wouldn't have been able to figure that one
out myslef for sure.
"Nicholas Paldino [.NET/C# MVP]" wrote: Alpha,
That is the problem. You are binding to dsVehicle.Tables["vehDetail"] in the bindings, and to the data set in the vlisting.
Change the code to set the data bindings in the VListing to:
VListing.SetDataBinding(dsVehicle.Tables["vehDetail"], null);
And it should work.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:E0**********************************@microsof t.com... VListing is the datagrid and it's datasource is a dataset table: VListing.SetDataBinding(dsVehicle, "VehDetail");
The textbox is only bind to the datagrid through the same dataset table: txtVName.DataBindings.Add("Text", dsVehicle.Tables["vehDetail"], "VName");
I don't have any view created for this. These controls are all on the same form.
Thank you, Alpha
"Nicholas Paldino [.NET/C# MVP]" wrote:
Alpha,
It seems like you either have separate binding contexts, or that you are binding to different data sources. First off, are the textboxes and data grid in the same form? If not, then you have to create a binding context and have the forms share it.
Second, how are you setting the data source in the bindings and the data source in the grid? If you have a data set with a table, "Table", for example, the following two are NOT the same:
dataGrid.DataSource = dataSet; dataGrid.DataMember = "Table";
// Is not the same as. dataGrid.DataSource = dataSet.Tables["Table"];
Also, are you using any views, by chance? Are you binding to different views?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:0E**********************************@microsof t.com... >I have several textboxes that I need to chang the text when the >selection >row > is changed in a datagrid. I have the following code. This textbox > displayes > the initial selection but when I click on different rows in the > datagrid, > the > textbox content doesn't change to reflect the change. How can I > address > this? > > Also, If the user change the text in the textbox then how do I refesh > the > display in the datagrid to reflect the changes? > > Thanks, Alpha
Alpha,
It does look at both the data source and the data member, but it uses
those two things together to determine if the data source is the same.
Since the data source for one was the table, and the data source for the
other was the data set (while the data member was null and the name of the
table respectively), it considers the data sources separate.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:5D**********************************@microsof t.com... Hummmm, like magic, it's working just great! I don't quite understand. I followed the databinding sytax for the datagrid, to put datasource as dataset and the datamember as the table. You have it all specified in the datasource.
So I guess the textbox binding only looks at the datagrid's datasource and not the datamember, is that correct? And that's the source of my problem? Hummmm.... Thank you so much. I wouldn't have been able to figure that one out myslef for sure.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Alpha,
That is the problem. You are binding to dsVehicle.Tables["vehDetail"] in the bindings, and to the data set in the vlisting.
Change the code to set the data bindings in the VListing to:
VListing.SetDataBinding(dsVehicle.Tables["vehDetail"], null);
And it should work.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:E0**********************************@microsof t.com... > VListing is the datagrid and it's datasource is a dataset table: > VListing.SetDataBinding(dsVehicle, "VehDetail"); > > The textbox is only bind to the datagrid through the same dataset > table: > txtVName.DataBindings.Add("Text", dsVehicle.Tables["vehDetail"], > "VName"); > > I don't have any view created for this. These controls are all on the > same > form. > > Thank you, Alpha > > "Nicholas Paldino [.NET/C# MVP]" wrote: > >> Alpha, >> >> It seems like you either have separate binding contexts, or that >> you >> are >> binding to different data sources. First off, are the textboxes and >> data >> grid in the same form? If not, then you have to create a binding >> context >> and have the forms share it. >> >> Second, how are you setting the data source in the bindings and >> the >> data >> source in the grid? If you have a data set with a table, "Table", for >> example, the following two are NOT the same: >> >> dataGrid.DataSource = dataSet; >> dataGrid.DataMember = "Table"; >> >> // Is not the same as. >> dataGrid.DataSource = dataSet.Tables["Table"]; >> >> Also, are you using any views, by chance? Are you binding to >> different >> views? >> >> >> -- >> - Nicholas Paldino [.NET/C# MVP] >> - mv*@spam.guard.caspershouse.com >> >> "Alpha" <Al***@discussions.microsoft.com> wrote in message >> news:0E**********************************@microsof t.com... >> >I have several textboxes that I need to chang the text when the >> >selection >> >row >> > is changed in a datagrid. I have the following code. This textbox >> > displayes >> > the initial selection but when I click on different rows in the >> > datagrid, >> > the >> > textbox content doesn't change to reflect the change. How can I >> > address >> > this? >> > >> > Also, If the user change the text in the textbox then how do I >> > refesh >> > the >> > display in the datagrid to reflect the changes? >> > >> > Thanks, Alpha >> >> >>
Thank you.
"Nicholas Paldino [.NET/C# MVP]" wrote: Alpha,
It does look at both the data source and the data member, but it uses those two things together to determine if the data source is the same. Since the data source for one was the table, and the data source for the other was the data set (while the data member was null and the name of the table respectively), it considers the data sources separate.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:5D**********************************@microsof t.com... Hummmm, like magic, it's working just great! I don't quite understand. I followed the databinding sytax for the datagrid, to put datasource as dataset and the datamember as the table. You have it all specified in the datasource.
So I guess the textbox binding only looks at the datagrid's datasource and not the datamember, is that correct? And that's the source of my problem? Hummmm.... Thank you so much. I wouldn't have been able to figure that one out myslef for sure.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Alpha,
That is the problem. You are binding to dsVehicle.Tables["vehDetail"] in the bindings, and to the data set in the vlisting.
Change the code to set the data bindings in the VListing to:
VListing.SetDataBinding(dsVehicle.Tables["vehDetail"], null);
And it should work.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Alpha" <Al***@discussions.microsoft.com> wrote in message news:E0**********************************@microsof t.com... > VListing is the datagrid and it's datasource is a dataset table: > VListing.SetDataBinding(dsVehicle, "VehDetail"); > > The textbox is only bind to the datagrid through the same dataset > table: > txtVName.DataBindings.Add("Text", dsVehicle.Tables["vehDetail"], > "VName"); > > I don't have any view created for this. These controls are all on the > same > form. > > Thank you, Alpha > > "Nicholas Paldino [.NET/C# MVP]" wrote: > >> Alpha, >> >> It seems like you either have separate binding contexts, or that >> you >> are >> binding to different data sources. First off, are the textboxes and >> data >> grid in the same form? If not, then you have to create a binding >> context >> and have the forms share it. >> >> Second, how are you setting the data source in the bindings and >> the >> data >> source in the grid? If you have a data set with a table, "Table", for >> example, the following two are NOT the same: >> >> dataGrid.DataSource = dataSet; >> dataGrid.DataMember = "Table"; >> >> // Is not the same as. >> dataGrid.DataSource = dataSet.Tables["Table"]; >> >> Also, are you using any views, by chance? Are you binding to >> different >> views? >> >> >> -- >> - Nicholas Paldino [.NET/C# MVP] >> - mv*@spam.guard.caspershouse.com >> >> "Alpha" <Al***@discussions.microsoft.com> wrote in message >> news:0E**********************************@microsof t.com... >> >I have several textboxes that I need to chang the text when the >> >selection >> >row >> > is changed in a datagrid. I have the following code. This textbox >> > displayes >> > the initial selection but when I click on different rows in the >> > datagrid, >> > the >> > textbox content doesn't change to reflect the change. How can I >> > address >> > this? >> > >> > Also, If the user change the text in the textbox then how do I >> > refesh >> > the >> > display in the datagrid to reflect the changes? >> > >> > Thanks, Alpha >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Amadelle |
last post by:
Hi all and thanks in advance for your help,
I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template...
|
by: Paul Slavin |
last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??
any answers appreciated, as to due to the underlying...
|
by: Alpha |
last post by:
Hi, I have a window based program. One of the form has several textboxes and
a datagrid. The textboxes are bind to the same dataset table as the datagrid
and the text changes to reflect different...
|
by: Manish |
last post by:
Hey folks
I am having a weird problem in ASP .Net. My page is in C#. I have a
datagrid, which populates based on selection in drop down box on ASP
page. This datagrid has template textbox colum in...
|
by: Amadelle |
last post by:
Hi all and thanks in advance for your help,
I have a problem with capturing the changed value of a text box in a
datagrid. The datagrid is populated based on a dataset and I am using
template...
|
by: Adda |
last post by:
If I cycle through the MdiChildActivate event of the
parent form I can read text in a textbox on the child
mdiform --
console.writeline(Me.ActiveMdiChild.Controls(1).Text)
But if I have a sub...
|
by: jose.mendez22 |
last post by:
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...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |