Hiding a row

6 posts, 0 answers
  1. Jugoslav
    Jugoslav avatar
    64 posts
    Member since:
    Mar 2011

    Posted 23 Sep 2011 Link to this post

    How do i do that?
    I tried something like following:
    Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
        ' display only items with images provided
        Dim item As GridDataItem = CType(e.Item, GridDataItem)
        If DataBinder.Eval(item.DataItem, "Image").ToString = "" Then
            ' do not show up the record/row
        End If
    End Sub

    Thank you


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Sep 2011 Link to this post

    Hello Jugoslav,

    Here is a sample code to achieve the same.
    VB:
    Protected Sub RAdGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            Dim s As String = item("EmployeeID").Text
            If s = "5" Then
                item.Display = False
            End If
        End If
    End Sub

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jugoslav
    Jugoslav avatar
    64 posts
    Member since:
    Mar 2011

    Posted 23 Sep 2011 Link to this post

    Ok i already found a thread with your reply/solution. Actually i am more concerned about the hidden items. For instance i may want to iterate all the items one by one ignoring page and ignoring the hidden items. How it's possible? Thanks for the previous reply it is much appreciated.
  5. Jugoslav
    Jugoslav avatar
    64 posts
    Member since:
    Mar 2011

    Posted 26 Sep 2011 Link to this post

    EDIT: This is the deal; i am using CUSTOM PAGING retrieving say 20 items per recordset. It often happens that all the 20 items should be hidden so i end up with an empty page in the RadGrid. Odd right?
    Maybe i should check the image existence in the SQL code? What do you suggest? THANK YOU SO MUCH
  6. Marin
    Admin
    Marin avatar
    1045 posts

    Posted 28 Sep 2011 Link to this post

    Hi Jugoslav,

     I believe it is more appropriate to make those operations on a data level, before the records are passed as a datasource to the grid. If you do not want to show a certain record why bind it to the grid then. My suggestion is to check whether the records correspond to a certain condition before they are bound to the grid either on database level or in code behind in NeedDataSource event or the Selecting event of the SqlDataSource control depending on what binding you use. If you end up that none of the records should be shown you can make another query to retrieve more records or use a NoRecords template to notify the user that there are no items on this page.

    Regards,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  7. Jugoslav
    Jugoslav avatar
    64 posts
    Member since:
    Mar 2011

    Posted 28 Sep 2011 Link to this post

    Ok this is not related to your controls anymore so you don't have to reply if you don't want.
    My original idea was to do it on a data level within Stored Procedure. But my problem was that i am not able to use the xp_fileexist in the where clause.

    PSEUDO CODE:
    SELECT blahblah ... WHERE (xp_fileexist ColumnThatContainsTheFileNames)

    But it seems that it cannot be used in this way :( unfortunately

    Any other ideas about how do i retrieve only data in which columnthatcontainsfilename value exists as file on the server?

    Thank you so much
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017