Edit

D

Demetri

I have a datagrid and is endowed with the edit/update/cancel buttons. I have a routine that handles the editcommand event for the datagrid, which sets the EditItemIndex to the e.Item.ItemIndex value - I then rebind the data.

The buttons change from edit to update and cancel but the cells remain the same - no text boxes appear.

What am I doing wrong? I need the text boxes to appear for the user to edit the information.

Thanks
 
A

Aaron Weiker

Demetri,
It sounds like you may be using Template Columns in your datagrid. If this
is the case you will need to make sure that you also implement the
EditItemTemplate as well as the ItemTemplate. In order to fully implement
the update button in the datagrid you will need to handle the UpdateCommand
event. The MSDN documentation for this can be found here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/htm
l/frlrfSystemWebUIWebControlsDataGridClassUpdateCommandTopic.asp

(Watch out for wrapping)

Aaron Weiker
http://aaronweiker.com/
 
D

Demetri

Actually the columns are created at runtime (auto generate). The only columns I've added with property builder is the edit/update/cancel buttons.

In a previous application I wrote - all I had to do was set the EditItemIndex to be 0 or greater and the grid generated the textboxes for me. The only difference in that application to this one is the fact that I did create bound columns in it. So I'm wondering if that is what is limiting me now.
 
D

Demetri

I added a bound column and voila when I go into edit mode the textbox appears for that column but the other (auto generated) columns don't have that luxury

Is there a way around this? What I have is a droplist with table names and when a user selects one the sql statement selects all rows from the selected table and then I bind a datareader to the grids datasource and call the grids databind method. In otherwords I dont know what the field names will be in design time in order to make bound columns in design time
 

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,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top