Datagrid UpdateCommand not taking new value

  • Thread starter Brett Hargreaves
  • Start date
B

Brett Hargreaves

Hi,

I'm having trouble with the datagrid update command.

I have a datagrid called grid that poulates itself with data in the page
load event.

When I click the edit button it takes me into edit mode no pronlem, however
when I change the data in the edit cell it is not picking up the newly typed
value, it passes back the original value. eg, the orgincal value is
"hello", I change it to "goodbye" but it passes back "hello" to my update
procedure.

Any ideas why?

Just to add a bit more confusion, if I don't load and bind the data to the
grid in the Page_Load event, but instead do it through a link button AFTER
the page has been loaded it works fine!!??
 
B

Brett Hargreaves

I've tried with and without. The data needs to be loaded on the IsPostBack
and the !IsPostBack


Brett
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,
Any ideas why?


I think that it's the usual behavior, see it like if the grid has two
status, and it;s your responsability to keep both of them in sync. when you
change a row you have to persist that info in the datasource ( datagrid,
array, collection, etc ) and then rebind the grid.
 
B

Brett Hargreaves

I've just found what's casuing the issue, but don't know how to fix the new
issue!

Basically, instead of inplace editing I redirected to a completely new page
that held a textbox control. If I prgramatically fill the textbox control's
Text property with a value (eg from a database using txtPrice.Text =
reader(0)) then I get the same problem, ie when I chaange the text on the
webform it posts back the original data again.

But I didn;t BIND the data to the control, i just set its Text property. It
just dosn;t pick it up when I a change this value and post it back

????
 

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

Top