Hi LeoDeRuyter,
Welcome to ASPNET newsgroup.
Regarding on the question you mentioned, based on my research, when the
boundField in the GridView control being set to invisible, the value won't
be available in the Rowdeleting command's Values pareamter collection, nor
will it be available through the GridView.Rows....xxxx field(since it is
not rendered out).
For such scenario, we'll suggest you consider either of the following
approach:
1. though the boundfield has such limit, we can use the Template
column/field which can contain inner sub controls, we can put a certain
html or server control(for example, a textbox or label) which contains the
custom value you want to store and set it to invisible. Then, in the
deleting command or other GridView's postback command we can use
GridView.Rows[x].Cells[y].FindControl to locate the inner control for the
custom value.
2. As the same in asp.net 1.x, we can use the GridView's RowDataBound
event to add custom value into each Row's Attributes collection. Like:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["key"] = Value;
}
}
Then, we can retrieve the value back through the Attributes collection.
Just some of my advice. Hope helps.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Gridview containing hidden row-ID (.NET 2.0)
| thread-index: AcWuMwZ7quSbl+opT6SOj7LwGGPPpQ==
| X-WBNR-Posting-Host: 213.10.174.3
| From: "=?Utf-8?B?SGVpbiBkZSBSdXl0ZXI=?=" <
[email protected]>
| Subject: Gridview containing hidden row-ID (.NET 2.0)
| Date: Wed, 31 Aug 2005 06:51:02 -0700
| Lines: 6
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10639
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| I tried to store the ID of a row (e.g. CustomerID) in a field in the
gridview
| (.NET 2.0). But when I hide the column of the gridview, the value cannot
be
| retrieved via de gridview-object in the rowdeleting-event
| [gridview.rows(e.rowid).cells(id-of-cell-with-CustomerID)]. Is there
another
| way to catch the ID of a row in the rowdeleting-event without connecting
the
| gridview directly to a datasource? Thanks in advance!
|