Make cells in Table webcontrol 'clickable'?

Discussion in 'ASP .Net' started by Paul W, Oct 1, 2004.

  1. Paul W

    Paul W Guest

    I'm using a Table webcontrol to display a 'grid' to the user. Various cells
    should be 'clickable' by the user (to run javascript). How can I make this
    happen? (currently I use the background cell color to indicate to the user
    which cells are clickable).

    (I think I could achieve this by adding an image (with attached hyperlink)
    to each clickable cell but since this is a large table (7 x 30) I think this
    might be a slow solution).

    Thanks,

    Paul.
     
    Paul W, Oct 1, 2004
    #1
    1. Advertising

  2. Alternatively place a div inside the tablecell and you can handle the onclick
    events.
    HTH
    srini

    "Paul W" wrote:

    > I'm using a Table webcontrol to display a 'grid' to the user. Various cells
    > should be 'clickable' by the user (to run javascript). How can I make this
    > happen? (currently I use the background cell color to indicate to the user
    > which cells are clickable).
    >
    > (I think I could achieve this by adding an image (with attached hyperlink)
    > to each clickable cell but since this is a large table (7 x 30) I think this
    > might be a slow solution).
    >
    > Thanks,
    >
    > Paul.
    >
    >
    >
     
    =?Utf-8?B?c3Jpbmk=?=, Oct 1, 2004
    #2
    1. Advertising

  3. Paul W

    Paul W Guest

    Thanks. So would I add the DIV by adding a Literal control to the tablecell
    (which I'm familiar with)?
    If so, what would actually be inside the DIV? - I don't want to display any
    text in the cells. I tried the following but it didn't work:

    <div> onclick="myfunc(1,1)"</div>

    I don't believe there's a DIV web control - have I missed it?

    Paul.

    "srini" <> wrote in message
    news:...
    > Alternatively place a div inside the tablecell and you can handle the
    > onclick
    > events.
    > HTH
    > srini
    >
    > "Paul W" wrote:
    >
    >> I'm using a Table webcontrol to display a 'grid' to the user. Various
    >> cells
    >> should be 'clickable' by the user (to run javascript). How can I make
    >> this
    >> happen? (currently I use the background cell color to indicate to the
    >> user
    >> which cells are clickable).
    >>
    >> (I think I could achieve this by adding an image (with attached
    >> hyperlink)
    >> to each clickable cell but since this is a large table (7 x 30) I think
    >> this
    >> might be a slow solution).
    >>
    >> Thanks,
    >>
    >> Paul.
    >>
    >>
    >>
     
    Paul W, Oct 1, 2004
    #3
  4. System.Web.UI.WebControls.Panel.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "Paul W" <> wrote in message
    news:...
    > Thanks. So would I add the DIV by adding a Literal control to the

    tablecell
    > (which I'm familiar with)?
    > If so, what would actually be inside the DIV? - I don't want to display

    any
    > text in the cells. I tried the following but it didn't work:
    >
    > <div> onclick="myfunc(1,1)"</div>
    >
    > I don't believe there's a DIV web control - have I missed it?
    >
    > Paul.
    >
    > "srini" <> wrote in message
    > news:...
    > > Alternatively place a div inside the tablecell and you can handle the
    > > onclick
    > > events.
    > > HTH
    > > srini
    > >
    > > "Paul W" wrote:
    > >
    > >> I'm using a Table webcontrol to display a 'grid' to the user. Various
    > >> cells
    > >> should be 'clickable' by the user (to run javascript). How can I make
    > >> this
    > >> happen? (currently I use the background cell color to indicate to the
    > >> user
    > >> which cells are clickable).
    > >>
    > >> (I think I could achieve this by adding an image (with attached
    > >> hyperlink)
    > >> to each clickable cell but since this is a large table (7 x 30) I think
    > >> this
    > >> might be a slow solution).
    > >>
    > >> Thanks,
    > >>
    > >> Paul.
    > >>
    > >>
    > >>

    >
    >
     
    Kevin Spencer, Oct 1, 2004
    #4
  5. On Fri, 1 Oct 2004 09:14:48 -0400, "Paul W" <> wrote:

    >Thanks. So would I add the DIV by adding a Literal control to the tablecell
    >(which I'm familiar with)?


    Yes.

    >If so, what would actually be inside the DIV? - I don't want to display any
    >text in the cells. I tried the following but it didn't work:
    >
    ><div> onclick="myfunc(1,1)"</div>


    No, it would need to look like this:
    <div onClick="myfunc(1,1)"> ... </div>

    >I don't believe there's a DIV web control - have I missed it?


    Not that I know of. I believe System.Web.UI.LiteralControl (as you
    stated above) should get you what you want. Personally, I use
    System.Web.UI.HtmlControls.HtmlGenericControl, but your way should
    work as well.

    >Paul.
    >



    --
    Thanks,
    Chris Simmons
     
    Chris Simmons, Oct 1, 2004
    #5
  6. Paul W

    Paul W Guest

    I'm familiar with panels, but not sure exactly what you intend. Should I add
    a panel control to the tablecell's control collection?
    What exactly do I first put in the panel?

    Thanks,

    Paul.
    "Kevin Spencer" <> wrote in message
    news:%...
    > System.Web.UI.WebControls.Panel.
    >
    > --
    > HTH,
    > Kevin Spencer
    > .Net Developer
    > Microsoft MVP
    > I get paid good money to
    > solve puzzles for a living
    >
    > "Paul W" <> wrote in message
    > news:...
    >> Thanks. So would I add the DIV by adding a Literal control to the

    > tablecell
    >> (which I'm familiar with)?
    >> If so, what would actually be inside the DIV? - I don't want to display

    > any
    >> text in the cells. I tried the following but it didn't work:
    >>
    >> <div> onclick="myfunc(1,1)"</div>
    >>
    >> I don't believe there's a DIV web control - have I missed it?
    >>
    >> Paul.
    >>
    >> "srini" <> wrote in message
    >> news:...
    >> > Alternatively place a div inside the tablecell and you can handle the
    >> > onclick
    >> > events.
    >> > HTH
    >> > srini
    >> >
    >> > "Paul W" wrote:
    >> >
    >> >> I'm using a Table webcontrol to display a 'grid' to the user. Various
    >> >> cells
    >> >> should be 'clickable' by the user (to run javascript). How can I make
    >> >> this
    >> >> happen? (currently I use the background cell color to indicate to the
    >> >> user
    >> >> which cells are clickable).
    >> >>
    >> >> (I think I could achieve this by adding an image (with attached
    >> >> hyperlink)
    >> >> to each clickable cell but since this is a large table (7 x 30) I
    >> >> think
    >> >> this
    >> >> might be a slow solution).
    >> >>
    >> >> Thanks,
    >> >>
    >> >> Paul.
    >> >>
    >> >>
    >> >>

    >>
    >>

    >
    >
     
    Paul W, Oct 1, 2004
    #6
  7. Paul W

    bruce barker Guest

    add a client side onclick to the td/th (cell)

    cell.Attributes.Add("onclick","doCilck(this);");



    "Paul W" <> wrote in message
    news:%...
    > I'm using a Table webcontrol to display a 'grid' to the user. Various

    cells
    > should be 'clickable' by the user (to run javascript). How can I make this
    > happen? (currently I use the background cell color to indicate to the user
    > which cells are clickable).
    >
    > (I think I could achieve this by adding an image (with attached hyperlink)
    > to each clickable cell but since this is a large table (7 x 30) I think

    this
    > might be a slow solution).
    >
    > Thanks,
    >
    > Paul.
    >
    >
     
    bruce barker, Oct 1, 2004
    #7
  8. Hi Paul,

    You wer asking:

    > >> I don't believe there's a DIV web control - have I missed it?


    A System.Web.UI.WebControls.Panel object renders a div on the client.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "Paul W" <> wrote in message
    news:...
    > I'm familiar with panels, but not sure exactly what you intend. Should I

    add
    > a panel control to the tablecell's control collection?
    > What exactly do I first put in the panel?
    >
    > Thanks,
    >
    > Paul.
    > "Kevin Spencer" <> wrote in message
    > news:%...
    > > System.Web.UI.WebControls.Panel.
    > >
    > > --
    > > HTH,
    > > Kevin Spencer
    > > .Net Developer
    > > Microsoft MVP
    > > I get paid good money to
    > > solve puzzles for a living
    > >
    > > "Paul W" <> wrote in message
    > > news:...
    > >> Thanks. So would I add the DIV by adding a Literal control to the

    > > tablecell
    > >> (which I'm familiar with)?
    > >> If so, what would actually be inside the DIV? - I don't want to display

    > > any
    > >> text in the cells. I tried the following but it didn't work:
    > >>
    > >> <div> onclick="myfunc(1,1)"</div>
    > >>
    > >> I don't believe there's a DIV web control - have I missed it?
    > >>
    > >> Paul.
    > >>
    > >> "srini" <> wrote in message
    > >> news:...
    > >> > Alternatively place a div inside the tablecell and you can handle the
    > >> > onclick
    > >> > events.
    > >> > HTH
    > >> > srini
    > >> >
    > >> > "Paul W" wrote:
    > >> >
    > >> >> I'm using a Table webcontrol to display a 'grid' to the user.

    Various
    > >> >> cells
    > >> >> should be 'clickable' by the user (to run javascript). How can I

    make
    > >> >> this
    > >> >> happen? (currently I use the background cell color to indicate to

    the
    > >> >> user
    > >> >> which cells are clickable).
    > >> >>
    > >> >> (I think I could achieve this by adding an image (with attached
    > >> >> hyperlink)
    > >> >> to each clickable cell but since this is a large table (7 x 30) I
    > >> >> think
    > >> >> this
    > >> >> might be a slow solution).
    > >> >>
    > >> >> Thanks,
    > >> >>
    > >> >> Paul.
    > >> >>
    > >> >>
    > >> >>
    > >>
    > >>

    > >
    > >

    >
    >
     
    Kevin Spencer, Oct 1, 2004
    #8
  9. Paul W

    Paul W Guest

    Wonderful. Thanks.

    "bruce barker" <> wrote in message
    news:...
    > add a client side onclick to the td/th (cell)
    >
    > cell.Attributes.Add("onclick","doCilck(this);");
    >
    >
    >
    > "Paul W" <> wrote in message
    > news:%...
    >> I'm using a Table webcontrol to display a 'grid' to the user. Various

    > cells
    >> should be 'clickable' by the user (to run javascript). How can I make
    >> this
    >> happen? (currently I use the background cell color to indicate to the
    >> user
    >> which cells are clickable).
    >>
    >> (I think I could achieve this by adding an image (with attached
    >> hyperlink)
    >> to each clickable cell but since this is a large table (7 x 30) I think

    > this
    >> might be a slow solution).
    >>
    >> Thanks,
    >>
    >> Paul.
    >>
    >>

    >
    >
     
    Paul W, Oct 1, 2004
    #9
  10. Paul W

    Alex Homer Guest

    Except not all browsers support client-side onclick events for a table
    cell...
     
    Alex Homer, Oct 3, 2004
    #10
    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. COHENMARVIN
    Replies:
    2
    Views:
    651
    Lucas Tam
    Sep 12, 2005
  2. Replies:
    0
    Views:
    558
  3. Deshaies
    Replies:
    3
    Views:
    4,611
    Deshaies
    Apr 20, 2004
  4. Harry
    Replies:
    10
    Views:
    34,003
    Hywel Jenkins
    Sep 26, 2003
  5. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    341
    Joel Finkel
    Sep 1, 2003
Loading...

Share This Page