Hi Carl,
From what I can see you are in the right direction but you cannot use
the FindControl method of the DataGrid itself to find a control in a
templatecolumn... there would be one control with that ID for each row
in the grid.
So... instead of
dgExistingFiles.Controls("imTick").Visible = True
you need to use the DataGridItemEventArgs e param that is passed in to
get
a reference to the control. For ex: if your image is the only control
in the first column of the datagrid:
e.Item.Cells[0].Controls[1].Visible = false
would do the trick (Controls[1] because the system always adds a
literal control before your server control, at least this is what I
have found)
If its in the second column use Cells[1] instead, etc... If there are
other controls in the column you will have to play around with the
Controls[] index to find the right one.
John
"Carl Howarth" <ca**********@m-s-solutions.co.uk> wrote in message news:<#d**************@TK2MSFTNGP11.phx.gbl>...
Thanks Jon,
This is the way in which I got around the problem, I would however be v
interested to find out how to alter a control's properties from the backend
code... could anybody point me in the right direction?
Thanks, Carl
"Jon Sequeira" <js******@twcny.rr.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl... In the .aspx file you could set the Image's Visible property to the
databound value, something like this:
<asp:Image Visible="<%# CBool(DataBinder.Eval(Container,
"DataItem.showTickGraphic") %>"> </asp:Image>
If this will acheive what you're looking for, it's a little less complex
than diving into the databinding events.
Hope that's useful,
--Jon
"Carl Howarth" <ca**********@m-s-solutions.co.uk> wrote in message
news:#q**************@TK2MSFTNGP11.phx.gbl... Hi,
I have a datagrid being populated using an sqldatareader. One of the
columns returns a bit value which currently gets displayed as 'True' or
'False'.
I would like to be able to display an image of a tick when this value is
true, and have placed an asp.net image control within the relevant template column. I presume I can achieve this within the databinding event of the grid, but am unsure as to quite how!
I would be grateful if anyone could shed some light on this!
Many thanks, Carl
ca**********@m-s-solutions.co.uk