473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

DataGrid and Template Columns Refreshing

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.

Nov 19 '05 #1
0 1091

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Just D | last post by:
Hi All, Does anybody know how to write the following code? I have a database table with a few columns including: ID , "Task" , ForceRun . I need to show the DataGrid on the ASPX page with...
5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
3
by: Brad | last post by:
I'm working with a DataGrid in C#, and the user needs to be able add and remove columns from the DataGrid on the fly, without opening and closing the form. The scenario is this. I have a setup...
4
by: | last post by:
I have a datagrid with a template column that has a hyperlink and a label. The hyperlink text is bound to Title from my dataset and the label text is bound to Author in the dataset. The grid...
4
by: Richard Roche | last post by:
Is it possible to use a drop combo instead of a text box when using the EditCommand in the Datagrid? Many table columns are bound to 'lookup' tables, user's don't care about the foreign keys,...
2
by: Nicole | last post by:
I am creating template columns programmatically. I have read the msdn article on this and I'm so close. Article:...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: Stephan Bour | last post by:
Hi, I have a datagrid databound to a SQL query. I'd like to allow editing of some columns but not all. Is there a way to turn off the conversion of the datagrid cells to textboxes for some columns...
8
by: Matt | last post by:
Guys I could really use some help with this. I think that it's probably a simple solution but I haven't been able to find anything. I have a datagrid on my form that I populate via code like...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.