Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Changing ImageURL of Image Button which is added in template column of datagrid

Reply
Thread Tools

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

 
 
raghunath
Guest
Posts: n/a
 
      04-28-2004
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.



 
Reply With Quote
 
 
 
 
Michael Tkachev
Guest
Posts: n/a
 
      04-29-2004
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" <(E-Mail Removed)>
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.
>
>
>



 
Reply With Quote
 
 
 
 
Kubuli John
Guest
Posts: n/a
 
      04-29-2004
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" <(E-Mail Removed)> wrote in message news:<u4V$(E-Mail Removed)>...
> 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" <(E-Mail Removed)>
> 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.
> >
> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting Column width of Template Column in Datagrid.. Charleees ASP .Net 2 06-20-2006 12:52 PM
DataGrid loses view state if first column is a template column. Ken Varn ASP .Net 1 08-19-2005 02:54 PM
HyperLink Column and Button Column in a DataGrid =?Utf-8?B?V2FyYW4=?= ASP .Net 0 08-09-2005 12:00 AM
how to know if a datagrid column is a template column? Dexter ASP .Net 1 01-18-2005 01:45 PM
Bound Column or Template Column (w dAdapater?) in DataGrid Ravichandran Mahalingam ASP .Net Datagrid Control 0 01-09-2004 03:30 PM



Advertisments