Picture Button

Discussion in 'ASP .Net Datagrid Control' started by Jason, Nov 10, 2003.

  1. Jason

    Jason Guest

    Hi

    I know this is probably simple, but i am running around stuck.

    All i want is a picture as a button in one of my columns on the datagrid
    control. when clicked, all that is done is a javascript "window.open()". How
    do i do this?

    Thanks
    Jason
    Jason, Nov 10, 2003
    #1
    1. Advertising

  2. Jason

    Alvin Bruney Guest

    if(e.Item.ItemType == ListItemType.Footer)
    {
    //build and add a label
    Panel lb = new Panel();
    Panel.BackImageUrl = "blah.gif";

    e.item.controls[3].Controls.Add(tb);
    tb = null;

    //embed javascript into the control

    e.Item.Cells[3].Attributes.Add("oncontextmenu","window.open('url.aspx');retu
    rn false;);
    }

    Here is an overview of the process. Put this code in an event handler such
    as the itemdatabound. Build out a control which can take a picture as a
    background. A panel will do nicely here. Add it to the cell being bound.
    Embed the required javascript in with the control. In this case, right
    clicking will fire of the javascript.
    This is off the top of my head so it isn't guaranteed to compile but it
    should provide the leg work to get things moving.

    regards
    --


    -----------
    Got TidBits?
    Get it here: www.networkip.net/tidbits
    "Jason" <> wrote in message
    news:...
    > Hi
    >
    > I know this is probably simple, but i am running around stuck.
    >
    > All i want is a picture as a button in one of my columns on the datagrid
    > control. when clicked, all that is done is a javascript "window.open()".

    How
    > do i do this?
    >
    > Thanks
    > Jason
    >
    >
    Alvin Bruney, Nov 10, 2003
    #2
    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. ulyx
    Replies:
    2
    Views:
    362
  2. Mr. Magic
    Replies:
    1
    Views:
    443
    Gregory A. Beamer
    Jan 4, 2010
  3. Andrew Chalk

    Picture on a button

    Andrew Chalk, Nov 20, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    109
    Andrew Chalk
    Nov 20, 2005
  4. Andrew Chalk

    Picture on a button

    Andrew Chalk, Nov 20, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    87
    Andrew Chalk
    Nov 20, 2005
  5. Replies:
    8
    Views:
    1,253
    Mick White
    Apr 19, 2005
Loading...

Share This Page