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

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

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



    raghunath Guest

  2. Similar Questions and Discussions

    1. Need to change image of imagebutton in datagrid template column
      I'm going nuts.. I've got a template column with an imagebutton in it. I would like to change the image on the button when the button is clicked. ...
    2. Changing an image in a datagrid column in the ItemDataBound event
      Hi, I have a datagrid that is bound to a datatable, I'm using TemplateColumns. The heading of two columns of the datagrid fire the...
    3. Bound Column or Template Column (w dAdapater?) in DataGrid
      I am able to get the data using DataAdapter and the DataReader. I am more inclined to use DataAdapter because I want to update the data on the SQL...
    4. Changing the binding of a template column
      I have a datagrid that is bound to different datasources. The datagrid contains a templated column (dropdown list). How do I change the...
    5. Template Column with button in header
      Hi, usually Button clicks inside DataGrid are managed by handling ItemCommand event of the grid. Button is given a CommandName that is checked in...
  3. #2

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

    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" <raghunath.mn@majoris.com>
    Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    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 Guest

  4. #3

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

    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" <m_tkachev@hotmail.com> wrote in message news:<u4V$eidLEHA.3292@TK2MSFTNGP11.phx.gbl>...
    > 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" <raghunath.mn@majoris.com>
    > Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139