Help with visual basic.net code

P

PatLaf

Hello all, I have a web forms datagrid that is setup for master detail. I used the example from Jeff Tan from MSFT but there is something wrong when it displays the details datagrid that is encapsulated in the hidden column on the master datagrid. When I click the details button the column displays but the details datagrid which is bound to a DataRow only displays two columns. One is RowError the other is HasErrors. The HasErrors column has False listed as the details records. I have asked about this 3 or four times but to no avail. It is not an html issue it is in the vb code. I am using a .select against the datasource of the grid. I do get enough rows to support the details attached to the master record but it will not display the details.
Here is the code along with some commented out pieces. The pieces that are commented out will show one detail record with a row for every letter that is to be displayed but alas that is not what I need. It seems to me the databind on the dr doesn't work correctly.

Private Sub dgDefects_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgDefects.ItemDataBoun
Dim dgi As DataGridItem = e.Ite
If dgi.ItemType = ListItemType.Item Or dgi.ItemType = ListItemType.AlternatingItem The
Dim c As Contro
For Each c In dgi.Cells(7).Control
If TypeOf (c) Is System.Web.UI.WebControls.DataGrid The
Dim id As Int32 = Int32.Parse(dgi.Cells(0).Text
Dim dg As DataGrid = CType(c, DataGrid
'Dim dg As CheckBoxList = CType(c, CheckBoxList
Dim dr As DataRow(
dr = m_dsDefects.Tables("Defect_Details").Select("Defect_ID=" & id
'Dim i As Integer = dr.Lengt
'If dr.Length > 0 The
' For i = 0 To
' dg.DataSource = dr(i).Item("Defect_Detail") '(0).Item("Defect_Detail"
' dg.DataBind(
' Nex
'End I
If dr.Length > 0 The
dg.DataSource = dr '(i).Item("Defect_Detail") '(0).Item("Defect_Detail"
dg.DataBind(
Els
Dim dr2 As DataRo
Dim dt As DataTable = New DataTabl
Dim dtCol As DataColumn = New DataColum
With dtCo
.ColumnName = "Detail Disposition
.DataType = System.Type.GetType("System.String"
.DefaultValue = "NO DETAILS
End Wit
dt.Columns.Add(dtCol
' Add one row. Since it has default values, no need to set values
dr2 = dt.NewRo
dt.Rows.Add(dr2
dg.DataSource = d
dg.DataBind(
End I
End I
Nex
End I
End Su

If I execute the commented out code I can see that the details are there yet they don't display. Any ideas? I am stuck on this issue and have been for 3 days. I have read as much as I could find about the datarow and the binding but there isn't anything in the docs that explains this behavior

Regard
Pat
 
J

Jeffrey Tan[MSFT]

Hi Pat,

I found that this is the same issue as issue in "Adding check list box
inside master detail web grid", I have added a reply in that post, please
check in that post.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top