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. Advertisements

  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. Advertisements

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. Purvi T
    Replies:
    0
    Views:
    1,152
    Purvi T
    Oct 19, 2004
  2. Wes Weems
    Replies:
    1
    Views:
    622
    Natty Gur
    Jul 20, 2003
  3. ulyx
    Replies:
    2
    Views:
    419
  4. Mr. Magic
    Replies:
    1
    Views:
    550
    Gregory A. Beamer
    Jan 4, 2010
  5. Andrew Chalk

    Picture on a button

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

    Picture on a button

    Andrew Chalk, Nov 20, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    127
    Andrew Chalk
    Nov 20, 2005
  7. H. Sommers

    A button with a picture

    H. Sommers, Dec 30, 2004, in forum: Javascript
    Replies:
    1
    Views:
    108
    Hywel Jenkins
    Dec 30, 2004
  8. Replies:
    8
    Views:
    1,721
    Mick White
    Apr 19, 2005
Loading...