Professional Web Applications Themes

Changing ImageURL of Image Button which is added in template column of datagrid - ASP.NET Data Grid Control

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

  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. #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.mnmajoris.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

  3. #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 doented
    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_tkachevhotmail.com> wrote in message news:<u4V$eidLEHA.3292TK2MSFTNGP11.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.mnmajoris.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

Similar Threads

  1. Need to change image of imagebutton in datagrid template column
    By jef in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: April 11th, 02:34 PM
  2. Replies: 2
    Last Post: September 8th, 12:41 PM
  3. Bound Column or Template Column (w dAdapater?) in DataGrid
    By Ravichandran Mahalingam in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: January 9th, 03:30 PM
  4. Changing the binding of a template column
    By Rob Edwards in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: October 17th, 02:06 PM
  5. changing the template column's position ?
    By Gary in forum ASP.NET Data Grid Control
    Replies: 4
    Last Post: October 15th, 09:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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