Changing ImageURL of Image Button which is added in template column of datagrid

Discussion in 'ASP .Net Datagrid Control' started by raghunath, Apr 28, 2004.

  1. raghunath

    raghunath Guest

    hello,


    I have a template column in my datagrid.
    To the header of template colum, i have added imagebutton.
    On click of the imagebutton , i want to change imageurl of image button.



    thanks in advance,
    Raghunath.
     
    raghunath, Apr 28, 2004
    #1
    1. Advertising

  2. You have to find this control (ImageButton) in the datagrid and then change
    value of property in this control.
    For this method don't use OnClick and OnCommand events for this buttton.

    protected void myItemCommand(... e) // Event OnItemCommand for Datagrid
    {
    ImageButton ib = ((ImageButton)e.Item.Cells[0].Controls[1]);
    ib.ImageUrl = "...";
    }

    that's all :)

    Michael


    ----- Original Message -----
    From: "raghunath" <>
    Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    Sent: Wednesday, April 28, 2004 11:03 AM
    Subject: Changing ImageURL of Image Button which is added in template column
    of datagrid


    > hello,
    >
    >
    > I have a template column in my datagrid.
    > To the header of template colum, i have added imagebutton.
    > On click of the imagebutton , i want to change imageurl of image button.
    >
    >
    >
    > thanks in advance,
    > Raghunath.
    >
    >
    >
     
    Michael Tkachev, Apr 29, 2004
    #2
    1. Advertising

  3. raghunath

    Kubuli John Guest

    How do you know to use Cells[0] and Controls[1]? Is this documented
    somewhere? I have had lots of problems trying to get an indexed
    reference to a specific control in a DataGrid, particularly in a
    template column custom header with multiple controls in it.

    Thanks,

    John H.

    "Michael Tkachev" <> wrote in message news:<u4V$>...
    > You have to find this control (ImageButton) in the datagrid and then change
    > value of property in this control.
    > For this method don't use OnClick and OnCommand events for this buttton.
    >
    > protected void myItemCommand(... e) // Event OnItemCommand for Datagrid
    > {
    > ImageButton ib = ((ImageButton)e.Item.Cells[0].Controls[1]);
    > ib.ImageUrl = "...";
    > }
    >
    > that's all :)
    >
    > Michael
    >
    >
    > ----- Original Message -----
    > From: "raghunath" <>
    > Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > Sent: Wednesday, April 28, 2004 11:03 AM
    > Subject: Changing ImageURL of Image Button which is added in template column
    > of datagrid
    >
    >
    > > hello,
    > >
    > >
    > > I have a template column in my datagrid.
    > > To the header of template colum, i have added imagebutton.
    > > On click of the imagebutton , i want to change imageurl of image button.
    > >
    > >
    > >
    > > thanks in advance,
    > > Raghunath.
    > >
    > >
    > >
     
    Kubuli John, Apr 29, 2004
    #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. ad
    Replies:
    3
    Views:
    1,023
    Alex Smith
    Jun 8, 2005
  2. Nathan Sokalski
    Replies:
    4
    Views:
    10,753
    nazanim2000
    Jun 2, 2010
  3. BillGatesFan
    Replies:
    1
    Views:
    449
    Nathan Sokalski
    Feb 15, 2008
  4. Nathan Sokalski

    Changing the width/height when using Hyperlink.ImageUrl

    Nathan Sokalski, Oct 8, 2005, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    183
    Arthur Dent
    Oct 10, 2005
  5. Nathan Sokalski

    Changing the width/height when using Hyperlink.ImageUrl

    Nathan Sokalski, Oct 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    161
    Arthur Dent
    Oct 10, 2005
Loading...

Share This Page