OnTextChanged and DataGridItems

G

Guest

Hi,

I currently have a datagrid with template columns containing textboxes etc.
The textboxes are in the item template so the whole grid is editable by
default, I then have a general update button to update the whole grid. I'm
using the example under
http://msdn.microsoft.com/library/d...QuestionsAboutASPNETDataGridServerControl.asp

I'm using the OnTextChanged event to capture which rows have been changed by
the user. Inside of this event I want to update the datasource of the
datagrid with the new values, my problem is that I can't seem to access the
new values. At this point everything is empty. I'm using
DataGridItem.Cells[0].Text etc to get the values, I can see that the grid has
the correct number of cells using the count but the values are all ""... any
ideas?
 
L

Lucifer

because your using a textbox event and not a datagrid event you dont
now from which row to get the new data?

you could try accessing the value from sender withing the textbox event

ctype(sender, textbox).text

but now you will need to know which row to save it into?

personally i wouldnt use OnTextChanged to save because it will cause
alot of server overhead.

coz it will do a server postback on each keypress wont it?


=?Utf-8?B?TmVpbA==?= said:
Hi,

I currently have a datagrid with template columns containing textboxes etc.
The textboxes are in the item template so the whole grid is editable by
default, I then have a general update button to update the whole grid. I'm
using the example under
http://msdn.microsoft.com/library/d...QuestionsAboutASPNETDataGridServerControl.asp

I'm using the OnTextChanged event to capture which rows have been changed by
the user. Inside of this event I want to update the datasource of the
datagrid with the new values, my problem is that I can't seem to access the
new values. At this point everything is empty. I'm using
DataGridItem.Cells[0].Text etc to get the values, I can see that the grid has
the correct number of cells using the count but the values are all ""... any
ideas?
 
G

Guest

Oops! Made a silly mistake, I've fixed this now.

I need to look at the controls collection within the cells to access the
textboxes!

thanks
 

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,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top