Results 1 to 3 of 3

Thread: cancel ItemDataCreated or ItemDataBound (stop row being created)

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    cancel ItemDataCreated or ItemDataBound (stop row being created)

    I am binding a data row toa few grids.
    When binding to one datagrid, I do not want items that have a field "username" equal to "WOOF".
    Is there a way in itemcreated or itembound to stop the row being created?

    Woka

  2. #2

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: cancel ItemDataCreated or ItemDataBound (stop row being created)

    I have done:
    VB Code:
    1. Private Sub grdUDFs_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdUDFs.ItemDataBound
    2.         Dim Item As DataGridItem = e.Item
    3.  
    4.         If Item.ItemType = ListItemType.AlternatingItem Or Item.ItemType = ListItemType.Item Then
    5.  
    6.             Dim UDFItem As UDF = CType(Item.DataItem, UDF)
    7.  
    8.             If UDFItem.Web Then
    9.                 'Populate grid item
    10.             Else
    11.                 Item.Visible=False
    12.             End if
    13.         End If
    14.    End Sub
    Is this OK?

    Woof

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: cancel ItemDataCreated or ItemDataBound (stop row being created)

    You can do that, or you can use a DataRowView object which has just what you want to display, you can use that for that particular datagrid.

Posting Permissions

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



Click Here to Expand Forum to Full Width