What does sender.Parent.Parent.Cells() reference? Frustrating...

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

  1. Roy

    Roy Guest

    Ok, this is incredibly annoying. Below I have an ImageButton and it's
    ImageButton_Click sub. See the 6 response.writes? The output for them
    is displayed below in asterisks. Question: What part of the
    TemplateColumn below does sender.parent.parent.Cells(9) reference???
    IOW, what tag does it reference? The templatecolumn is the 9th field in
    the datagrid yet no matter what I do, whatever
    "sender.parent.parent.Cells(9)" is referencing, I do not have access
    to. Help!

    *System.Web.UI.WebControls.TableCell*
    *blank, nothing displayed*
    *System.Web.UI.WebControls.DataGridItem*
    *blank, nothing displayed*
    *System.Web.UI.WebControls.TableCell*
    *blank, nothing displayed*


    Public Sub ImageButton_Click(sender As Object, e As
    ImageClickEventArgs)
    response.write(sender.parent)
    response.write(sender.parent.id)
    response.write(sender.parent.parent)
    response.write(sender.parent.parent.id)
    response.write(sender.parent.parent.Cells(9))
    response.write(sender.parent.parent.Cells(9).id) <<<<---REFERENCE?
    End Sub

    **********0th Column in datagrid*****
    <asp:TemplateColumn><ItemTemplate>
    <asp:ImageButton id="imagebutton1" runat="server" AlternateText="Click
    to Expand Record"
    ImageAlign="left" ImageUrl="arrow_right.gif"
    OnClick="ImageButton_Click"/>
    </ItemTemplate></asp:TemplateColumn>

    *********9th column in datagrid******
    <asp:TemplateColumn><ItemTemplate>
    <tr id="tr"><td colspan="9" id="td">
    <UC_Grid:Nested id="FVDGrid" x=<%# container.dataitem("vown")%> y=<%#
    container.dataitem("van_no")%> runat="server" />
    </td></tr>
    </ItemTemplate></asp:TemplateColumn>
    Roy, Feb 11, 2005
    #1
    1. Advertising

  2. Roy

    Scott Allen Guest

    It references the TableCell that will contain the controls for the
    template.

    Are you trying to locate a specific, named control like the nested
    grid? If so, I believe FindControl a bit less painful.

    See:
    http://odetocode.com/Articles/116.aspx

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On 11 Feb 2005 11:24:18 -0800, "Roy" <> wrote:

    >Ok, this is incredibly annoying. Below I have an ImageButton and it's
    >ImageButton_Click sub. See the 6 response.writes? The output for them
    >is displayed below in asterisks. Question: What part of the
    >TemplateColumn below does sender.parent.parent.Cells(9) reference???
    >IOW, what tag does it reference? The templatecolumn is the 9th field in
    >the datagrid yet no matter what I do, whatever
    >"sender.parent.parent.Cells(9)" is referencing, I do not have access
    >to. Help!
    >
    >*System.Web.UI.WebControls.TableCell*
    >*blank, nothing displayed*
    >*System.Web.UI.WebControls.DataGridItem*
    >*blank, nothing displayed*
    >*System.Web.UI.WebControls.TableCell*
    >*blank, nothing displayed*
    >
    >
    >Public Sub ImageButton_Click(sender As Object, e As
    >ImageClickEventArgs)
    >response.write(sender.parent)
    >response.write(sender.parent.id)
    >response.write(sender.parent.parent)
    >response.write(sender.parent.parent.id)
    >response.write(sender.parent.parent.Cells(9))
    >response.write(sender.parent.parent.Cells(9).id) <<<<---REFERENCE?
    >End Sub
    >
    >**********0th Column in datagrid*****
    ><asp:TemplateColumn><ItemTemplate>
    ><asp:ImageButton id="imagebutton1" runat="server" AlternateText="Click
    >to Expand Record"
    >ImageAlign="left" ImageUrl="arrow_right.gif"
    >OnClick="ImageButton_Click"/>
    ></ItemTemplate></asp:TemplateColumn>
    >
    >*********9th column in datagrid******
    ><asp:TemplateColumn><ItemTemplate>
    ><tr id="tr"><td colspan="9" id="td">
    ><UC_Grid:Nested id="FVDGrid" x=<%# container.dataitem("vown")%> y=<%#
    >container.dataitem("van_no")%> runat="server" />
    ></td></tr>
    ></ItemTemplate></asp:TemplateColumn>
    Scott Allen, Feb 11, 2005
    #2
    1. Advertising

  3. Roy

    Roy Guest

    Roy, Feb 11, 2005
    #3
    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. Showjumper
    Replies:
    2
    Views:
    1,791
    Showjumper
    Aug 2, 2003
  2. Dylan Parry
    Replies:
    2
    Views:
    541
  3. Replies:
    0
    Views:
    389
  4. Replies:
    0
    Views:
    350
  5. jodleren
    Replies:
    2
    Views:
    100
    Thomas 'PointedEars' Lahn
    Jan 31, 2008
Loading...

Share This Page