Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 April 3rd, 2005, 04:43 PM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retreiving data value within datagrid

Hi there,
Can anyone help me with a problem im having. I have a datagrid bound to a table with an id and datetime Date field. I want to be able to edit it, so ive added to edit colume and all that but the problem is i cannot read the date field no matter what i do. Perhaps im going down the complete wrong lane in my approach. I just can't get it working. Ive tried using

TableCell cell2 = (TableCell)e.Item.Controls[1];
DateTime myDate =convert.ToDateTime(((TextBox)cell2.Controls[1]).Text);

And ive tried reading the textbox as a string etc etc. does anyone know the proper way to read a date value from a textbox cell within a datagrid in order to edit that value and update. Any advice, links or code would be greatly appreciated - thanks

 
Old April 4th, 2005, 09:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

If it's a boundcolumn, use e.Item.Cells[1].Text; otherwise, do:

TableCell cell2 = (TableCell)e.Item.Cells[1];
DateTime myDate = DateTime.Parse(((TextBox)cell2.FindControl("textbo xname")).Text);

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Retreiving value from InputBox maniatis1 Classic ASP Professional 1 January 4th, 2007 03:36 PM
retreiving data from URL pavanntcs Oracle 1 September 20th, 2006 02:05 AM
Retreiving textbox values from datagrid ashish_26 General .NET 1 October 15th, 2004 11:47 PM
Retreiving data from unbound field? lanctotd Access VBA 7 July 28th, 2003 07:12 AM





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