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 January 30th, 2005, 08:29 AM
Registered User
 
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default get textbox value in DataGrid1_EditCommand

hi, i'm been trying to get the textbox value in the datagrid everytime the user click the edit in the datagrid, however,
i always get "System.NullReferenceException: Object reference not set to an instance of an object" this error
while executing string checkname1 = aTextBox.Text;

if the aTextbox is returning null , is there any way tat i get the value of the text box once the user click the edit button everytime?

anyone know how to solve this ? thanks in advance

public void DataGrid1_EditCommand(object sender, DataGridCommandEventArgs e)
{

DataGrid1.EditItemIndex = e.Item.ItemIndex;

BindGrid();

TextBox aTextBox;
aTextBox = ((TextBox)e.Item.FindControl("txtconstName"));
string checkname1 = aTextBox.Text;


}




 
Old January 30th, 2005, 11:08 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

do all of them in Update_Command event instead,you need just two lines in Edit_Command,
Code:
dgImpact.EditItemIndex = e.Item.ItemIndex;
BindGrid();
then in Update_Command find your TextBox and retrieve its properties.

_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.





Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox Help iceman90289 C# 2005 6 April 6th, 2008 03:54 AM
pointing cursor from one textbox to other textbox lakshmi_annayappa ASP.NET 1.0 and 1.1 Basics 2 August 2nd, 2007 03:41 PM
Textbox deontae45 VB.NET 2002/2003 Basics 1 September 25th, 2006 11:26 AM
textbox C# camelia_flower C# 2 September 15th, 2004 09:01 AM
Masked TextBox & formatting TextBox melvik C# 1 September 22nd, 2003 11:01 AM





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