Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2005, 07:17 PM
Registered User
 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Does Not Update ...

Hey All,

I am trying to update the data using adatagrid control, but i have a problem. Basically, when i press the edit and the text boxes show up with the data, i chage the data in any of them, but when i press update, nothing changes. I used the debugger and i noticed that simply the cell content do not change (i.e. stick back to the orginal values of the cell). Here is the code:

Code:
    Private Sub articlesDG_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles articlesDG.UpdateCommand
        Dim myID, authorNew, thisAuthor, subject, category As TextBox

        Dim try1, try2, try3, try4 As TextBox
        'variables used during debugging
        thisAuthor = CType(e.Item.FindControl("Author"), TextBox)
        try1 = e.Item.Cells(2).Controls(0)
        try2 = e.Item.Cells(3).Controls(0)

        myID = e.Item.Cells(2).Controls(0)

        Dim SQLstr As String
        SQLstr = "Update articles set Author='" & thisAuthor.Text & "' where articleID = " & myID.Text
        inventory.updateArticleData(SQLstr)

        articlesDG.EditItemIndex = -1
        articlesDG.DataBind()

    End Sub
I appreciate your help.

Hany

Regards,
Hany
 
Old March 28th, 2005, 04:46 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

an example of Datagrid using can be found at:
http://msdn.microsoft.com/library/en...datainsqldatab
ase.asp?frame=true

Forget the Update event, concentrate on the Edit -it illustrates the point
nicely.

Gokulan Ethiraj





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update a datagrid debbiecoates Beginning VB 6 0 January 4th, 2008 05:51 AM
datagrid update sumith ASP.NET 1.0 and 1.1 Basics 0 February 9th, 2007 02:14 AM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM
Datagrid Update madhavigujja ASP.NET 1.0 and 1.1 Basics 1 December 18th, 2005 03:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.