473,394 Members | 1,893 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,394 software developers and data experts.

Update value in datagrid

Hello ASPX expert !!

Here is my problem.

I have a datagrid binded to a dataview.

I edit the datagrid and change the value of my textBoxes from my datagrid.

When I click to update the data,

What I read is the old values (txtProduitVIPNo)

Any Idea??

thanks in advance !!

Esperanza !!

private void dgAdminCommandes_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

TextBox txtProduitVIPNo = (TextBox)e.Item.FindControl("txtProduitVIPNo");

TextBox txtProduitVIPNom = (TextBox)e.Item.FindControl("txtProduitVIPNom");


this.updCoopCommandes.Parameters["@OrderID"].Value =
dgCoopCommandes.DataKeys[e.Item.ItemIndex];

this.updCoopCommandes.Parameters["@ProduitVIPNo"].Value =
txtProduitVIPNo.Text;

this.updCoopCommandes.Parameters["@ProduitVIPNom"].Value =
txtProduitVIPNom.Text;

this.updCoopCommandes.Parameters["@TMPSTP_ADM"].Value = System.DateTime.Now;

this.sqlConn.Open();

this.updCoopCommandes.ExecuteNonQuery();

this.sqlConn.Close();

}
Apr 6 '06 #1
1 1961
You need to add the Update event for your datagrid and then write code to
update the data using the information in the current row. Normall you will
store the ID column of your table in a hidden column and use this and the
values in the row to manually update the backend database.

Welcome to the world of the web !

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
"esperanza" <es**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello ASPX expert !!

Here is my problem.

I have a datagrid binded to a dataview.

I edit the datagrid and change the value of my textBoxes from my datagrid.

When I click to update the data,

What I read is the old values (txtProduitVIPNo)

Any Idea??

thanks in advance !!

Esperanza !!

private void dgAdminCommandes_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

TextBox txtProduitVIPNo = (TextBox)e.Item.FindControl("txtProduitVIPNo");

TextBox txtProduitVIPNom =
(TextBox)e.Item.FindControl("txtProduitVIPNom");


this.updCoopCommandes.Parameters["@OrderID"].Value =
dgCoopCommandes.DataKeys[e.Item.ItemIndex];

this.updCoopCommandes.Parameters["@ProduitVIPNo"].Value =
txtProduitVIPNo.Text;

this.updCoopCommandes.Parameters["@ProduitVIPNom"].Value =
txtProduitVIPNom.Text;

this.updCoopCommandes.Parameters["@TMPSTP_ADM"].Value =
System.DateTime.Now;

this.sqlConn.Open();

this.updCoopCommandes.ExecuteNonQuery();

this.sqlConn.Close();

}

Apr 6 '06 #2

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

Similar topics

2
by: Manish | last post by:
Hey folks I am having a weird problem in ASP .Net. My page is in C#. I have a datagrid, which populates based on selection in drop down box on ASP page. This datagrid has template textbox colum in...
3
by: Kevin Pedersen | last post by:
Hello, I am using an editable datagrid. After I save the changes the datagrid shows the old values. I've read the posts about the Page_Load and not binding the datagrid each time. The SQL that...
13
by: abdoly | last post by:
i wrote a code to update datagrid with the datagrid updatecommand but i cant get the updated values after being update that is the code private void DataGrid1_UpdateCommand(object source,...
5
by: Hennie | last post by:
When trying to update a record in an editable datagrid I ran into a few problems. My update procedure is just not working. Can someone please have a look at my code and see what am I doing wrong....
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
4
by: Jonathan Upright | last post by:
Greetings to anyone who can help: I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable DataGrid" at the project selector screen. As you may know, it defaults to the Microsoft...
4
by: Reney | last post by:
I have a very weird problem in updating my datagrid. Please help me to solve it. The datagrid is tied to a dataset table with five columns. Three of them are primary key and the other two columns...
1
by: mursyidatun ismail | last post by:
Dear all, database use: Ms Access. platform: .Net i'm trying to update a record/records in a table called t_doctors by clicking da edit link provided in the database. when i ran through da...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.