Make a row invisible/not be shown when string = "blabla"

Discussion in 'ASP .Net' started by Richard, Jun 24, 2004.

  1. Richard

    Richard Guest

    After printing a userlist to a Datagrid i want some names not to be shown. I
    want to know how i can make a entire datagrid row invisible.

    I suspect its something with the OnItemDatabound but i am kinda stuck there.
    but this is basicly what i want.

    if Username = "Deleted_User" then
    'make entire table row invisible.
    End if

    I hope someone can give me the code on how i can accomplish this. Thx in
    advance.

    Richard
     
    Richard, Jun 24, 2004
    #1
    1. Advertising

  2. Richard

    avnrao Guest

    use this..
    private void DataGrid1_ItemDataBound(object sender,
    System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if((e.Item.FindControl("") as Label).Text == "Deleted_User")
    e.Item.Visible = false;
    }

    Av.
    "Richard" <> wrote in message
    news:40da2454$0$31751$...
    > After printing a userlist to a Datagrid i want some names not to be shown.
    > I
    > want to know how i can make a entire datagrid row invisible.
    >
    > I suspect its something with the OnItemDatabound but i am kinda stuck
    > there.
    > but this is basicly what i want.
    >
    > if Username = "Deleted_User" then
    > 'make entire table row invisible.
    > End if
    >
    > I hope someone can give me the code on how i can accomplish this. Thx in
    > advance.
    >
    > Richard
    >
    >
    >
    >
    >
     
    avnrao, Jun 24, 2004
    #2
    1. Advertising

  3. Richard

    Richard Guest

    Well, that didnt work for me. What i want is to make the entire row
    invisible.

    <asp:DataGrid ....... bla bla....>
    <asp:BoundColumn DataField="U_Username" SortExpression="U_Username"
    HeaderText="<strong>Username</strong>" />
    <asp:BoundColumn DataField="A_LEVELNAAM" SortExpression="A_LEVELNAAM"
    HeaderText="<strong>Level</strong>" />
    <asp:BoundColumn DataField="U_Posts" SortExpression="U_Posts"
    HeaderText="<strong>Posts</strong>" />
    <asp:BoundColumn DataField="U_Registered_On"
    SortExpression="U_Registered_On" HeaderText="<strong>Date
    Registered</strong>" />
    <asp:BoundColumn DataField="U_Last_Logged_In"
    SortExpression="U_Last_Logged_In" HeaderText="<strong>Last Active</strong>"
    />
    </columns>
    </asp:DataGrid>

    Whenever a username equels "Deleted_User" i would like that the entire row
    would be invisible not only the username but every column.
    If it's possible i'd like the example/code in VB. my C# aint good. :D

    thx in advance Richard




    "avnrao" <> schreef in bericht
    news:...
    > use this..
    > private void DataGrid1_ItemDataBound(object sender,
    > System.Web.UI.WebControls.DataGridItemEventArgs e)
    > {
    > if((e.Item.FindControl("") as Label).Text == "Deleted_User")
    > e.Item.Visible = false;
    > }
    >
    > Av.
    > "Richard" <> wrote in message
    > news:40da2454$0$31751$...
    > > After printing a userlist to a Datagrid i want some names not to be

    shown.
    > > I
    > > want to know how i can make a entire datagrid row invisible.
    > >
    > > I suspect its something with the OnItemDatabound but i am kinda stuck
    > > there.
    > > but this is basicly what i want.
    > >
    > > if Username = "Deleted_User" then
    > > 'make entire table row invisible.
    > > End if
    > >
    > > I hope someone can give me the code on how i can accomplish this. Thx in
    > > advance.
    > >
    > > Richard
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Richard, Jun 24, 2004
    #3
  4. Richard

    Richard Guest

    well i finally finished it :D

    Sub myDataGrid_ItemDataBound(Sender As Object, e As DataGridItemEventArgs)
    If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <>
    ListItemType.Footer then
    Dim lblUsername As Label = E.Item.FindControl("lblUsername")
    If NOT lblUsername Is Nothing then
    If RTrim(lblUsername.Text) = "" OR RTrim(lblUsername.Text) =
    "Deleted User" Then
    e.item.Visible = False
    End If
    End If
    End If
    End Sub

    this my code and it worked :D thx for your help avnrao.


    "avnrao" <> schreef in bericht
    news:...
    > use this..
    > private void DataGrid1_ItemDataBound(object sender,
    > System.Web.UI.WebControls.DataGridItemEventArgs e)
    > {
    > if((e.Item.FindControl("") as Label).Text == "Deleted_User")
    > e.Item.Visible = false;
    > }
    >
    > Av.
    > "Richard" <> wrote in message
    > news:40da2454$0$31751$...
    > > After printing a userlist to a Datagrid i want some names not to be

    shown.
    > > I
    > > want to know how i can make a entire datagrid row invisible.
    > >
    > > I suspect its something with the OnItemDatabound but i am kinda stuck
    > > there.
    > > but this is basicly what i want.
    > >
    > > if Username = "Deleted_User" then
    > > 'make entire table row invisible.
    > > End if
    > >
    > > I hope someone can give me the code on how i can accomplish this. Thx in
    > > advance.
    > >
    > > Richard
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Richard, Jun 24, 2004
    #4
    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. Peter Maas

    blabla

    Peter Maas, May 23, 2005, in forum: Python
    Replies:
    2
    Views:
    412
    Jwaixs
    May 23, 2005
  2. =?Utf-8?B?RGFpc3k=?=
    Replies:
    0
    Views:
    817
    =?Utf-8?B?RGFpc3k=?=
    Aug 23, 2007
  3. Andy B
    Replies:
    5
    Views:
    630
    Andy B
    May 29, 2008
  4. RickM
    Replies:
    1
    Views:
    502
    Peter Kellner
    Apr 10, 2006
  5. Mete Akalýn
    Replies:
    1
    Views:
    439
    Mete Akalýn
    Jul 25, 2003
Loading...

Share This Page