473,569 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid binding problem

no
Hi all,

I have a dataset that contain 2 tables and a relationship between them
(master detail).
I bind this dataset to a form that include some textboxes that bind to the
parent record, and a datagrid that is binded to the detailed records.

Here is the code:

Code:
Private Sub FillHeader(ByRe f dsDataSet As DataSet)
Try
txtKey.DataBind ings.Add(New Binding("text", dsDataSet , "header.key "))
txtNo.DataBindi ngs.Add(New Binding("text", dsDataSet , "header.no" ))
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

Code:
Private Sub FillLines(ByRef dsDataSet As DataSet)
Try
dsDataSet.Table s("lines").Colu mns("key").Colu mnMapping =
MappingType.Hid den
dsDataSet.Table s("lines").Colu mns("product_id ").ColumnNa me = "Product
Id"
dsDataSet.Table s("lines").Colu mns("quantity") .ColumnName = "Quantity"
dgLines.SetData Binding(dsDataS et.Tables!lines , "HeaderLine s")
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

The sub I use to navigate is (For example I put only the next command):

Code:
Sub cmdNext() Implements ICommandNext.cm dNext
Try
bdRecordNavigat or = BindingContext( dsHeader, "header")
bdRecordNavigat or.Position += 1
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

My problem happens when I navigate between the master records. The textboxes
show the correct values, but there is no change in the datagrid. What do I
miss here, that this sub will handle the datagrid as well?

Thanks
Apr 20 '06 #1
3 1667
Hi,

You need to use datagrid.setdat abinding to get the child grid to
only display the filtered records.

http://www.vb-tips.com/default.aspx?...7-7bc3068aca2c

http://www.vb-tips.com/default.aspx?...e-e8335682ad3a

Ken
-----------------

"no" wrote:
Hi all,

I have a dataset that contain 2 tables and a relationship between them
(master detail).
I bind this dataset to a form that include some textboxes that bind to the
parent record, and a datagrid that is binded to the detailed records.

Here is the code:

Code:
Private Sub FillHeader(ByRe f dsDataSet As DataSet)
Try
txtKey.DataBind ings.Add(New Binding("text", dsDataSet , "header.key "))
txtNo.DataBindi ngs.Add(New Binding("text", dsDataSet , "header.no" ))
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

Code:
Private Sub FillLines(ByRef dsDataSet As DataSet)
Try
dsDataSet.Table s("lines").Colu mns("key").Colu mnMapping =
MappingType.Hid den
dsDataSet.Table s("lines").Colu mns("product_id ").ColumnNa me = "Product
Id"
dsDataSet.Table s("lines").Colu mns("quantity") .ColumnName = "Quantity"
dgLines.SetData Binding(dsDataS et.Tables!lines , "HeaderLine s")
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

The sub I use to navigate is (For example I put only the next command):

Code:
Sub cmdNext() Implements ICommandNext.cm dNext
Try
bdRecordNavigat or = BindingContext( dsHeader, "header")
bdRecordNavigat or.Position += 1
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

My problem happens when I navigate between the master records. The textboxes
show the correct values, but there is no change in the datagrid. What do I
miss here, that this sub will handle the datagrid as well?

Thanks

Apr 20 '06 #2
Ken Tucker,
Thanks for your reply
The tips you supplyed heled me a lot.

All I had to do was to add a line before the catch statement that solved the
whole problem:
dgItems.SetData Binding(dsPOHea der, "purchase_order _header.POHeade rLines")

Thanks again

Ohad

"Ken Tucker [MVP]" <Ke**********@d iscussions.micr osoft.com> wrote in message
news:B5******** *************** ***********@mic rosoft.com...
Hi,

You need to use datagrid.setdat abinding to get the child grid to
only display the filtered records.

http://www.vb-tips.com/default.aspx?...7-7bc3068aca2c

http://www.vb-tips.com/default.aspx?...e-e8335682ad3a

Ken
-----------------

"no" wrote:
Hi all,

I have a dataset that contain 2 tables and a relationship between them
(master detail).
I bind this dataset to a form that include some textboxes that bind to
the
parent record, and a datagrid that is binded to the detailed records.

Here is the code:

Code:
Private Sub FillHeader(ByRe f dsDataSet As DataSet)
Try
txtKey.DataBind ings.Add(New Binding("text", dsDataSet ,
"header.key "))
txtNo.DataBindi ngs.Add(New Binding("text", dsDataSet , "header.no" ))
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

Code:
Private Sub FillLines(ByRef dsDataSet As DataSet)
Try
dsDataSet.Table s("lines").Colu mns("key").Colu mnMapping =
MappingType.Hid den
dsDataSet.Table s("lines").Colu mns("product_id ").ColumnNa me = "Product
Id"
dsDataSet.Table s("lines").Colu mns("quantity") .ColumnName = "Quantity"
dgLines.SetData Binding(dsDataS et.Tables!lines , "HeaderLine s")
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

The sub I use to navigate is (For example I put only the next command):

Code:
Sub cmdNext() Implements ICommandNext.cm dNext
Try
bdRecordNavigat or = BindingContext( dsHeader, "header")
bdRecordNavigat or.Position += 1
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

My problem happens when I navigate between the master records. The
textboxes
show the correct values, but there is no change in the datagrid. What do
I
miss here, that this sub will handle the datagrid as well?

Thanks

Apr 20 '06 #3
Ken Tucker,
Thanks for your reply
The tips you supplyed heled me a lot.

All I had to do was to add a line before the catch statement that solved the
whole problem:
dgLines.SetData Binding(dsDataS et, "header.HeaderL ines")

Thanks again

Ohad

"Ken Tucker [MVP]" <Ke**********@d iscussions.micr osoft.com> wrote in message
news:B5******** *************** ***********@mic rosoft.com...
Hi,

You need to use datagrid.setdat abinding to get the child grid to
only display the filtered records.

http://www.vb-tips.com/default.aspx?...7-7bc3068aca2c

http://www.vb-tips.com/default.aspx?...e-e8335682ad3a

Ken
-----------------

"no" wrote:
Hi all,

I have a dataset that contain 2 tables and a relationship between them
(master detail).
I bind this dataset to a form that include some textboxes that bind to
the
parent record, and a datagrid that is binded to the detailed records.

Here is the code:

Code:
Private Sub FillHeader(ByRe f dsDataSet As DataSet)
Try
txtKey.DataBind ings.Add(New Binding("text", dsDataSet ,
"header.key "))
txtNo.DataBindi ngs.Add(New Binding("text", dsDataSet , "header.no" ))
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

Code:
Private Sub FillLines(ByRef dsDataSet As DataSet)
Try
dsDataSet.Table s("lines").Colu mns("key").Colu mnMapping =
MappingType.Hid den
dsDataSet.Table s("lines").Colu mns("product_id ").ColumnNa me = "Product
Id"
dsDataSet.Table s("lines").Colu mns("quantity") .ColumnName = "Quantity"
dgLines.SetData Binding(dsDataS et.Tables!lines , "HeaderLine s")
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

The sub I use to navigate is (For example I put only the next command):

Code:
Sub cmdNext() Implements ICommandNext.cm dNext
Try
bdRecordNavigat or = BindingContext( dsHeader, "header")
bdRecordNavigat or.Position += 1
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

My problem happens when I navigate between the master records. The
textboxes
show the correct values, but there is no change in the datagrid. What do
I
miss here, that this sub will handle the datagrid as well?

Thanks

Apr 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1838
by: Tom Hughes | last post by:
I want to change one field of all selected rows to a provided value. Problem 1 I am using the Binding Manager Base to bind the datagrid to the appropriate dataTable as recommended by KB817247. It works in all cases but one. If the field being changed is also one the user has selected as a sort column, then all but the first selections are...
5
2574
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order date, name, address etc) about the selected row in the datagrid... My problem is when I enter a new record in the details tabpage (saves data...
4
2824
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the form/grid first opens up and the grid is immediately sorted the TB don't reflect the sorted data of the First row of the grid. Note: Initially...
0
3481
by: Dave | last post by:
Tried posting in the Winform Forum without much luck, so posting here... After inserting a new data row to a DataTable that is bound to a datagrid, I am unable to change data in a row that is after the newly added row without getting bizarre results. I have added the full code for the test below. Create a project drop in the code and...
6
3309
by: Alpha | last post by:
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...
3
4898
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on...
2
1317
by: Brad Shook | last post by:
First of all thinks to Cor Ligthert for helping me with this last week. If you wild like to read Cor's comments please refer to the posting from 10/14/2004 and 8:48AM "Help with Advanced Datagrid" I am trying to bind one column of a datagrid to a seperate textbox and the rest of the fields to a datagrid. the comments are too large to fit...
17
2739
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only allow user to filter the first time, when they tried the second time, the speficied cast error message will prompt one.... I create a mydataset1...
9
2711
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not...
2
6572
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the...
0
7703
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7926
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.