ButtonColumn as Image?

Discussion in 'ASP .Net Datagrid Control' started by TheDude5B, Mar 2, 2006.

  1. TheDude5B

    TheDude5B Guest

    I am using a ButtonColumn which is used to delete an item from the
    datagrid.

    Is it possible to use an image instead of just text for this
    ButtonControl?


    If this is not possible, then how would i change the code for this
    ButtonControl to work with an ASP reapeater instead.

    for example just now i have the buttoncontrol linked to the procedure

    Sub Delete_Item (Sender As Object, E As DataGridCommandEventArgs)

    objDT = Session("cart")
    objDT.Rows(e.Item.ItemIndex).Delete()
    Session("cart") = objDT

    End Sub


    but if using an asp repeater

    i am wanting to use this code

    <a href='<%#
    Databinder.Eval(Container.DataItem,"ItemName","delete.aspx&id={0}" )
    %>'><img src="images/x.gif" border="0" alt="Remove Item" />

    to be used to delete the selected item. However as u will notice, the
    code on the ASP repeater line will open up the page delete.aspx, I do
    not want to do this and just be able to use code on the same page to
    delete the selected row.

    All Help is welcome.

    Thanks
     
    TheDude5B, Mar 2, 2006
    #1
    1. Advertising

  2. TheDude5B

    Elton Wang Guest

    Yes something like

    <asp:ButtonColumn Text="<IMG src='~/Images/myImage.gif'; border='0'>"
    CommandName="delete"></asp:ButtonColumn>

    HTH

    "TheDude5B" <> wrote in message
    news:...
    >I am using a ButtonColumn which is used to delete an item from the
    > datagrid.
    >
    > Is it possible to use an image instead of just text for this
    > ButtonControl?
    >
    >
    > If this is not possible, then how would i change the code for this
    > ButtonControl to work with an ASP reapeater instead.
    >
    > for example just now i have the buttoncontrol linked to the procedure
    >
    > Sub Delete_Item (Sender As Object, E As DataGridCommandEventArgs)
    >
    > objDT = Session("cart")
    > objDT.Rows(e.Item.ItemIndex).Delete()
    > Session("cart") = objDT
    >
    > End Sub
    >
    >
    > but if using an asp repeater
    >
    > i am wanting to use this code
    >
    > <a href='<%#
    > Databinder.Eval(Container.DataItem,"ItemName","delete.aspx&id={0}" )
    > %>'><img src="images/x.gif" border="0" alt="Remove Item" />
    >
    > to be used to delete the selected item. However as u will notice, the
    > code on the ASP repeater line will open up the page delete.aspx, I do
    > not want to do this and just be able to use code on the same page to
    > delete the selected row.
    >
    > All Help is welcome.
    >
    > Thanks
    >
     
    Elton Wang, Mar 2, 2006
    #2
    1. Advertising

  3. TheDude5B

    TheDude5B Guest

    Thats worked great thanks!

    Pat on the back for you my good friend!! :)
     
    TheDude5B, Mar 3, 2006
    #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. Northern
    Replies:
    0
    Views:
    405
    Northern
    Jul 22, 2003
  2. CGuy
    Replies:
    2
    Views:
    2,015
  3. John
    Replies:
    3
    Views:
    3,246
    Giorgio Parmeggiani
    Nov 3, 2003
  4. Roger

    ButtonColumn

    Roger, Jan 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    552
    Ken Cox [Microsoft MVP]
    Jan 23, 2004
  5. =?Utf-8?B?Sm9obiBNY0RvbmFnaA==?=

    ButtonColumn postback problem

    =?Utf-8?B?Sm9obiBNY0RvbmFnaA==?=, Mar 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    392
    =?Utf-8?B?Sm9obiBNY0RvbmFnaA==?=
    Mar 6, 2004
Loading...

Share This Page