DataGrid and Template Columns Refreshing

K

kevin_giles78

hello everyone.
There may be a better way to do what I want but please bear with me as
I need a simple explanation of how to do something with a data grid.

I have a grid showing a status in a column. I want two image buttons in
a single column. Only one of these should be visible at a time
dependent upon the row data. Clicking on the button should update the
underlying data and then (and this is the bit I can't get working)
refresh the grid (somehow forcing a databind??), which will then redraw
the correct button. The underlying data being changed will affect which
button should show.

If I have two button columns I will still have to force a databind
SOMEWHERE(?) to make the relevant button column disabled.

Currently here is my attempta t the solution, but I cannot see how to
force a rebind. In which level of the code should this be done? How do
I access the datagrid from that level (or maybe its datasource to
refresh?)?

I have a grid which contains a template column. The template column has
a PlaceHolder and this contains two buttons.
The visibility of the buttons is set according to the content of the
ROW in the grid. Either one or the other button is shown.


This works through the initial DataBind fine.


Now I wan to click a button and have the following take place: -
The data in list from which the grid was originally populated is
altered.
The grid is refreshed in some way to cause the databind to be called
for the rows which should allow the visibility of the buttons in the
placeholder of the template column to be set according to the NEW
values of the rows.


In my source I have a new class
public class renderActionButtons : ITemplate
which takes care of the rendering of the buttons.


The problem is that I cannot work out how to make the grid (the owing
container of the datagrid item which contains the buttons) refresh
itself.


If this is not clear, I can post (lots) more and I am willing to send
the entire current source to anyoine who has the time, or impetus to
look at this.


I really find it difficult to get my head around who can do what to
whom in this environment, especially when things are create
dynamically. Has anyone any suggestions for "beginners guides"?


TIA,


Kevin


P.S. I would like to thank Ken for his previous help but I am still
trying to get things simplified for me to understand.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top