 |
| 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
|
|
|
|

January 25th, 2005, 02:48 PM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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...
|
|

January 25th, 2005, 05:50 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Have you tried debugging it and setting a break point at that line to see what value it is being set to?
J
|
|

January 26th, 2005, 10:35 AM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi, yes i tried this. and the value is "", i mean a blank string. no exception, no errors...??????
|
|

January 26th, 2005, 02:30 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
What event are you placing your code in that grabs the value of the cell?
|
|

January 26th, 2005, 04:39 PM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the code is placed inside the update and delete event handlers for the proper dbgrid .
|
|

January 26th, 2005, 04:46 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
where is the label located...inside or outside of the grid?
|
|

January 27th, 2005, 08:56 AM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the label is located outside of the grid.
|
|

January 27th, 2005, 09:56 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
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?
|
|

January 27th, 2005, 01:23 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Yes, more code would be helpful.
|
|

January 28th, 2005, 10:36 AM
|
|
Authorized User
|
|
Join Date: Jan 2005
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!!!";
}
|
|
 |