Using CommandName to Identify specific control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim McGivney

    Using CommandName to Identify specific control

    In VWD I have a webpage that contains a number of ImageButtons. Each
    ImageButton has a unique CommandName (e.g. IB1, IB2, etc). I can tell
    which ImageButton has been pressed by testing for the CommandName in the
    event handler (e.CommandName = IB1). I now want to change the background
    color of this ImageButton. How can I programmaticall y accomplish this? How
    do I pragmatically access a specific ImageButton when I know its
    CommandName? Sample code would be appreciated.

    Thanks in advance for your help,

    Jim


  • Alberto Poblacion

    #2
    Re: Using CommandName to Identify specific control

    "Jim McGivney" <mcgiv1@no-spam.sbcglobal. netwrote in message
    news:%23XKbRC8P JHA.584@TK2MSFT NGP06.phx.gbl.. .
    In VWD I have a webpage that contains a number of ImageButtons. Each
    ImageButton has a unique CommandName (e.g. IB1, IB2, etc). I can tell
    which ImageButton has been pressed by testing for the CommandName in the
    event handler (e.CommandName = IB1). I now want to change the background
    color of this ImageButton. How can I programmaticall y accomplish this?
    How do I pragmatically access a specific ImageButton when I know its
    CommandName? Sample code would be appreciated.
    Instead of checking for the e.CommandName in the event handler, it will
    be easier to use the "sender" argument, which refers to the object that
    triggered the event.

    ((ImageButton)s ender).BackColo r = Color.Red;

    Comment

    Working...