Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 September 3rd, 2003, 02:57 PM
Registered User
 
Join Date: Sep 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retrieving value from Datagrid texbox

Hi there

I can't seem to get this working. I have a datagrid with one single editable field. I call the update command and want to update my database with what the user has filled into the box, however, I cannot seem to get the value back from the text box, I keep getting the OLD value back.

 Private Sub grd1_updatecommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles grd1.UpdateCommand

Response.Write(CType(e.Item.Cells(0).Controls(0), TextBox).Text)

 End Sub

That was just to "debug" and see what was being replied.

Anyone got any idea?
 
Old September 3rd, 2003, 03:30 PM
Authorized User
 
Join Date: Jul 2003
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have often had this problem and found that it had nothing to do witht he function submitting the result but actualy was with Page_Load. Make sure you have you code that builds your page encased in the following if statement:

if not page.ispostback then
   <insert code to build page here>
else
end if

otherwise everytime you page loads it will rebuild your grid and you will lose your new data before you grd1_updatecommand function fires. The first function/sub to fire on your page is page_load.

I hope this helps

 
Old September 3rd, 2003, 03:36 PM
Registered User
 
Join Date: Sep 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes! Thanks Craig this was the problem, I forgot to have this in my page load event.

You are the man!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving a parameter from a deleting datagrid dcct84 C# 3 November 1st, 2007 12:08 PM
sending values to texbox hastikeyvan Dreamweaver (all versions) 1 September 27th, 2005 07:59 AM
texbox update in Datagrid msrnivas General .NET 1 June 1st, 2005 01:46 AM
When to declare variable as texbox or string? method ASP.NET 1.x and 2.0 Application Design 3 May 16th, 2005 03:16 PM
Retrieving Primary key in DataGrid shahchi1 ASP.NET 1.0 and 1.1 Basics 10 August 10th, 2004 03:21 PM





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