Results 1 to 2 of 2

Thread: Datagrid

  1. #1
    Join Date
    Dec 1969

    Default Datagrid

    Does anyone know how to fill a datagrid step by step without using:<BR><BR>MyAdapt.Fill(DSet, "Table")<BR>DataGrid1.DataSource = DSet.Tables("Table").DefaultView<BR>DataGrid1.Data Bind()<BR><BR>I need to be able to control the records that are filling the datagrid. the reason is that I need to fill different tables in the same datagrid... each table different from the other so I will have different column headers in the datagid as well. If no one knows, were could I look! thanks for your time and help

  2. #2
    Join Date
    Dec 1969

    Default RE: Datagrid

    Try using the OnItemDataBound. This will run everytime a row has been bound. You might try OnItemCreated if you want to do some checking before the row is actually bound.<BR><BR>Put this in your DG declaration: OnItemDataBound="Item_Bound"<BR><BR>Then this in your CodeBehind:<BR> Sub Item_Bound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)<BR><BR> &#039;Make sure we are dealing with Items or AlternatingItems<BR> If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then<BR> If e.Item.DataItem("FieldName") = Value Then<BR> &#039;Do Something<BR> End if<BR> End If <BR><BR><BR>End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts