Hi Hajime,
Wherever you put your code to add columns to the datagrid, add the
following after this code. This may or may not work depending on how you
add the columns. Experiment to see if it works for you.
Dim i As Integer = DataGrid1.Columns.Count
Otherwise, the following should work every time. Place this code in either
the ItemCreated or the ItemDataBound events.
Dim i As Integer = e.Item.Cells.Count
---
I hope this helps.
Thank you, Mike
Microsoft, ASP.NET Support Professional
Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.
This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "Hajime Kusakabe" <go********@hotmail.com>
Subject: DataGridItemEventArgs.Item.Cells - How to find last cell?
Date: Thu, 23 Oct 2003 10:58:20 -0600
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Od**************@TK2MSFTNGP12.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: mail.msiincdirect.com 65.121.20.186
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186097
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
I made a datagrid and it contains several columns.
The number of columns depend on what users select from a dropdown list.
Therefore the number of columns changes.
I would like to find the last item (or last cell number) from the
datagrid. Is there a way to find the last cell number? (Something like "ubound"
function for array).
Thanks.
Haji