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 January 25th, 2005, 02:48 PM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default e.Item.Cells[0].Text Statement problem

hi there!!! i have a datagrid server control. and i want to display the text in the first cell on a message. a few days ago i did
   (string lbName = e.Item.Cells[0].Text )
with no problems, but now when i run the project, lbName remains blank (i mean ""). i'm confused about this 'cause i don't see any ostensible reason for this to happen. any idea of what's running bad? thanks again...
 
Old January 25th, 2005, 05:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Have you tried debugging it and setting a break point at that line to see what value it is being set to?

J
 
Old January 26th, 2005, 10:35 AM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi, yes i tried this. and the value is "", i mean a blank string. no exception, no errors...??????
 
Old January 26th, 2005, 02:30 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What event are you placing your code in that grabs the value of the cell?

 
Old January 26th, 2005, 04:39 PM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the code is placed inside the update and delete event handlers for the proper dbgrid .
 
Old January 26th, 2005, 04:46 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

where is the label located...inside or outside of the grid?

 
Old January 27th, 2005, 08:56 AM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the label is located outside of the grid.
 
Old January 27th, 2005, 09:56 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Are you trying to place this value in a string or inside a label? Can you post a little more code so we can see what you are doing?
 
Old January 27th, 2005, 01:23 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Yes, more code would be helpful.
 
Old January 28th, 2005, 10:36 AM
Authorized User
 
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok, here goes the entire function:

private void dgUsers_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            sqlConn.Open();
            string delname = e.Item.Cells[0].Text;
            SqlParameter myParm = sqlComDel.Parameters.Add("@id_Admin",SqlDbType.Int ,4);
            myParm.Value = dgUsers.DataKeys[(int)e.Item.ItemIndex];
            sqlComDel.ExecuteNonQuery();
            sqlDAUser.Fill(dsUsers);
            dgUsers.DataBind();
            sqlConn.Close();
            labMessage.Text = delname.ToUpper() + "has been deleted succesfully!!!";
        }





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add from text values into excel cells kotaiah Excel VBA 2 September 12th, 2006 10:55 AM
Trouble with formatting text in table cells! Sickopuppie HTML Code Clinic 5 June 21st, 2006 03:17 AM
Formatting e.Item.Cells in Datagrid rstelma ASP.NET 1.0 and 1.1 Professional 18 February 26th, 2006 07:34 AM
select statement with listbox item(where qnsID =" Astro VB How-To 2 August 31st, 2005 02:12 AM
Wrap text with merged cells aspadda Excel VBA 4 January 29th, 2004 03:02 PM





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