Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: update data


Message #1 by "Enrico Teotti" <enrico.teotti@m...> on Thu, 20 Mar 2003 10:42:23
Hi,


I have binded data in a datagrid. I would like to update the data. I have 
build a command column for the edit. Then I have build an update command. 
But when I press it and I try to retrieve the data with this:


public void DataGrid_Update(object sender, DataGridCommandEventArgs e)


		{	


// aggiornamento informazioni


string id = ((TextBox)e.Item.Cells[1].Controls[0]).Text;




but the value of the variabke id is not the value I have just inserted, but 
the precedent value. How could I retrieve the value I have just insert?


Thanks in advance,


Enrico
Message #2 by "Ivan Porto Carrero" <ivan@k...> on Thu, 20 Mar 2003 10:59:27


I get my ID values in the following way in the update routine

string id = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();

<asp:DataGrid id=DataGrid 1 style="Z-INDEX: 103; LEFT: 0px; POSITION: 
absolute; TOP: 216px" runat="server" Width="600px" DataSource="<%# 
myDataSet %>" DataMember="myTable" DataKeyField="ID" 
AutoGenerateColumns="False" PageSize="20" AllowPaging="True">

I hope this helps you



> Hi,

> 
I>  have binded data in a datagrid. I would like to update the data. I 
have 
b> uild a command column for the edit. Then I have build an update 
command. 
B> ut when I press it and I try to retrieve the data with this:

> 
p> ublic void DataGrid_Update(object sender, DataGridCommandEventArgs e)

> 
	> 	{	

> 
/> / aggiornamento informazioni

> 
s> tring id = ((TextBox)e.Item.Cells[1].Controls[0]).Text;

> 

> 
b> ut the value of the variabke id is not the value I have just inserted, 
but 
t> he precedent value. How could I retrieve the value I have just insert?

> 
T> hanks in advance,

> 
E> nrico
Message #3 by Marcie Robillard <marcierobillard@y...> on Thu, 20 Mar 2003 10:28:10 -0800 (PST)
http://www.datagridgirl.com/faq.aspx#OldValues

Datagrid Girl

--- Enrico Teotti <enrico.teotti@m...> wrote:
> Hi,
> 
> 
> I have binded data in a datagrid. I would like to
> update the data. I have 
> build a command column for the edit. Then I have
> build an update command. 
> But when I press it and I try to retrieve the data
> with this:
> 
> 
> public void DataGrid_Update(object sender,
> DataGridCommandEventArgs e)
> 
> 
> 		{	
> 
> 
> // aggiornamento informazioni
> 
> 
> string id 
> ((TextBox)e.Item.Cells[1].Controls[0]).Text;
> 
> 
> 
> 
> but the value of the variabke id is not the value I
> have just inserted, but 
> the precedent value. How could I retrieve the value
> I have just insert?
> 
> 
> Thanks in advance,
> 
> 
> Enrico


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

  Return to Index