OnButtonClick make an individual cell visible/invisible?

Discussion in 'ASP .Net' started by Roy, Feb 11, 2005.

  1. Roy

    Roy Guest

    What is the best way to approach this problem? I have a datagrid with
    an imagebutton. When one clicks the imagebutton it triggers an onClick
    sub which makes column 9 (a user control) visible or invisible. Only
    problem is when one clicks the imagebutton on a specific row, I want
    *only* that row's column 9 to appear or disappear.


    ********My imagebutton*******************
    <asp:TemplateColumn><ItemTemplate>
    <asp:ImageButton id="imagebutton1" runat="server"
    AlternateText="ImageButton 1" ImageAlign="left"
    ImageUrl="arrow_right.gif" OnClick="ImageButton_Click"/>
    </ItemTemplate></asp:TemplateColumn>


    *********My user control (row 9)*********
    <asp:TemplateColumn Visible = "false">
    <ItemTemplate><tr><td colspan="9">
    <UC_Grid:Nested id="FVDGrid" x=<%# container.dataitem("vown")%> y=<%#
    container.dataitem("van_no")%> runat="server" />
    </td></tr></ItemTemplate>
    </asp:TemplateColumn>


    **********My click sub**********
    Public Sub ImageButton_Click(sender As Object, e As
    ImageClickEventArgs)
    If MR_Grid.Columns(9).Visible = False Then
    MR_Grid.Columns(9).Visible = True
    Else
    MR_Grid.Columns(9).Visible = False
    End If
    End Sub


    I tried modifying the sub with the individual cell as seen below, but
    that bombs out with your average "'Item' is not a member of
    'System.Web.UI.ImageClickEventArgs'" error. Anyone have any clues on
    how I can implement this functionality?

    Public Sub ImageButton_Click(sender As Object, e As
    ImageClickEventArgs)
    If e.Item.Cells(9).Visible = False Then
    e.Item.Cells(9).Visible = True
    Else
    e.Item.Cells(9).Visible = False
    End If
    End Sub
    Roy, Feb 11, 2005
    #1
    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. john
    Replies:
    2
    Views:
    7,112
  2. Miguel Dias Moura

    Make panels visible and invisible.

    Miguel Dias Moura, Jun 17, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    12,562
    Ireney Berezniak
    Jun 21, 2004
  3. Roy
    Replies:
    8
    Views:
    1,845
    Danny
    Feb 14, 2005
  4. Selden McCabe
    Replies:
    5
    Views:
    10,219
    Selden McCabe
    Apr 25, 2005
  5. Replies:
    1
    Views:
    126
Loading...

Share This Page