Help with visual basic.net code

Discussion in 'ASP .Net Web Controls' started by PatLaf, Feb 11, 2004.

  1. PatLaf

    PatLaf Guest

    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
     
    PatLaf, Feb 11, 2004
    #1
    1. Advertising

  2. 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.
     
    Jeffrey Tan[MSFT], Feb 12, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Klemt
    Replies:
    3
    Views:
    3,135
    Brian W
    Jan 14, 2004
  2. M P
    Replies:
    6
    Views:
    566
    Joe Fallon
    Aug 7, 2004
  3. Stewart
    Replies:
    1
    Views:
    545
    Ken Cox [Microsoft MVP]
    Feb 24, 2006
  4. Anthony Moss

    visual basic from visual C++

    Anthony Moss, Dec 16, 2003, in forum: C++
    Replies:
    1
    Views:
    300
    Aggro
    Dec 16, 2003
  5. hunkgym
    Replies:
    1
    Views:
    2,022
    =?Utf-8?B?TGVvbiBNYXluZQ==?=
    Oct 30, 2006
Loading...

Share This Page