473,811 Members | 2,631 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

update problem in DataGrid's UpdateCommand method

Hi, anyone can help me to solve this little problem that
i've spent a lot of time to solve it!! but i can't!!!!

actually, i use a DataGrid, and i'd like to save the
changed data! ( this is just a trial method and i'll
use this method with a more complique method later,
that's why i can't use MxDataGrid)

but each time, DataGrid save the original data, not the
one after changed in the Textbox!!!
i've used Database Update Method!!!
but it can't save the new data in the database!
even though i use a Label6 to show out the changed data,
it can't show the new data too!!!

here is the code!!
anyone can give me a hand???

thanks!!!

Dawn
------------------------------
Sub MyDataGrid_Upda teCommand(sende r As Object, e As
DataGridCommand EventArgs)
Dim Ucode As TextBox = e.Item.Cells(1) .Controls(0)
Dim Unom As TextBox = e.Item.Cells(2) .Controls(0)
Dim Uetage As TextBox = e.Item.Cells(3) .Controls(0)
Dim Ubureau As TextBox = e.Item.Cells(4) .Controls(0)

Dim Upid As integer = e.Item.ItemInde x + 1
Dim Upcode As String = Ucode.Text
Dim Upnom As String = Unom.Text
Dim Upetage As String = Uetage.Text
Dim UpBureau As String = Ubureau.Text

Label6.Text= Upid & "--"& Upnom &"---" & Upcode & "--

UpdateSite(5,Up nom,Upcode,Upet age,UpBureau)
MyDataGrid.Edit ItemIndex = -1
BindGrid
End Sub
Nov 17 '05 #1
1 3438
you need to trace through the code and check the values passed into the 4
Strings you're pulling off the textboxes, then step into the UpdateSite
function to check this does what it says on the tin, i suspect it's in this
method that your problem lies.

Dan.

ps. it's worth noting your first parameter is "5" in the UpdateSite...
should this perhaps be Upid?
"dawn" <bi*********@ya hoo.com> wrote in message
news:30******** *************** *****@phx.gbl.. .
Hi, anyone can help me to solve this little problem that
i've spent a lot of time to solve it!! but i can't!!!!

actually, i use a DataGrid, and i'd like to save the
changed data! ( this is just a trial method and i'll
use this method with a more complique method later,
that's why i can't use MxDataGrid)

but each time, DataGrid save the original data, not the
one after changed in the Textbox!!!
i've used Database Update Method!!!
but it can't save the new data in the database!
even though i use a Label6 to show out the changed data,
it can't show the new data too!!!

here is the code!!
anyone can give me a hand???

thanks!!!

Dawn
------------------------------
Sub MyDataGrid_Upda teCommand(sende r As Object, e As
DataGridCommand EventArgs)
Dim Ucode As TextBox = e.Item.Cells(1) .Controls(0)
Dim Unom As TextBox = e.Item.Cells(2) .Controls(0)
Dim Uetage As TextBox = e.Item.Cells(3) .Controls(0)
Dim Ubureau As TextBox = e.Item.Cells(4) .Controls(0)

Dim Upid As integer = e.Item.ItemInde x + 1
Dim Upcode As String = Ucode.Text
Dim Upnom As String = Unom.Text
Dim Upetage As String = Uetage.Text
Dim UpBureau As String = Ubureau.Text

Label6.Text= Upid & "--"& Upnom &"---" & Upcode & "--

UpdateSite(5,Up nom,Upcode,Upet age,UpBureau)
MyDataGrid.Edit ItemIndex = -1
BindGrid
End Sub

Nov 17 '05 #2

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

Similar topics

13
7676
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, System.Web.UI.WebControls.DataGridCommandEventArgs e) TextBox temp temp=(TextBox)e.Item.Cells.Controls String str=temp.Text; str always returnt the old value of the cell (before being updated) would u plz tell me about whats wrong i m doin
3
2222
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I make the changes and click Update, it reverts back to the old value. I'm stumped! I've also checked the db table and it is infact not updating. I'm attempting to follow and example right out of ASP.NET Unleashed but not having much luck. Any...
1
1596
by: MrMike | last post by:
Hi. My application has dozens of datagrids but for some reason an exception occurs when one of them is updated. When a user edits a datagrid row and then clicks 'Update' the following exception occurs: --------------------- "Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index" --------------------- I've placed breakpoints with the UpdateCommand event, but...
4
3484
by: siaj | last post by:
Hello All, If some one has faced a similar issue.. My datagrid Update command is not getting fired in fact it seems that the no event fires on clicking the update link. Although the cancel and the Edit Commmand are getting fired properly. The One difference I have seen is that in the task bar ..on hovering on the link the javascript for the update link seems different. I dont know if it makes sense..
5
1875
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. I had to set the datagrid's DataKeyField to MailSubscriberID manually since vs does not do it automatically. Thanks
4
2154
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 SQL database "pubs". I've followed the instructions in the comments and also changed everything pertaining to SQL over to OLEDB. (i.e. Changed SqlDbType. to OleDbType.) I also changed the datafield names and variable names accordingly. The page...
1
2025
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 browsers and click update it gave me this error: Specified argument was out of the range of valid values. Parameter name:
2
1582
by: andrew.roberts | last post by:
This is my second post now on this subject has I seem to be getting no where and the problem is really starting to bug me now. I can get a datagrid into an editable state but then neither the Update or Cancel events seem to be firing and I am at a lost to explan why. My code is below, if any one can tell me what I am doing wrong then that would be excellent! using System; using System.Collections; using System.ComponentModel;
4
7036
by: Jason Huang | last post by:
Hi, In my .Net 1.1 C# winodows form project, I use the following code trying to update data via a DataGrid. private void UpdateDataSet(DataSet myDataSet){ if(!myDataSet.HasChanges(DataRowState.Modified)) return; DataSet xDataSet; xDataSet = myDataSet.GetChanges(DataRowState.Modified); if(xDataSet.HasErrors){ }
1
1743
by: rodriguez.a.christian | last post by:
I cannot make my update command work for a datagrid: Public Class subcatinsert Inherits System.Web.UI.Page Protected WithEvents SqlCon As System.Data.SqlClient.SqlConnection Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand Protected WithEvents SqlUpdateCommand1 As
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10392
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.