Re: getting the row number in a datagrid

matt.torline_at_bissell.com
Date: 12/29/04


Date: 29 Dec 2004 06:13:08 -0800

Use can use the parent control to find the index. All Controls have
parents and children, you can move up and down the node list to find
the one you are looking for. You can shorten the code, I just wanted
to make sure you saw the levels. Also a while back I was trying to
deal with CustomValidators in datagrids, I seem to recall some issues
with that just FYI. Hope this helps AuSable Troutbum

'Find the The control that is firing event
Dim valCustomControl As New CustomValidator
valCustomControl = sender

'Find the Parent Cell of Validation Control
Dim cell As TableCell = valCustomControl.Parent

'Find the Datagrid Item
Dim dgItem As DataGridItem = cell.Parent

'Set the Row
Dim myRow As DataRow =
DataSet.Tables("YourTableName").Rows(dgItem.ItemIndex)



Relevant Pages

  • Re: Controls - Page_init order
    ... the control after the Page_Load. ... Parent that says "Inside the Parent Page_Load", ... e as EventArgs) Dim sTest as String trace.warn("Inside the ... execute first before anything else since it is initialization code. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: What are the rules for Me.DesignMode
    ... ' Returns true if this control or any of its ancestors is in design mode ... Dim parent As Control = Me.Parent ... contains this UserControl and then I click the X in the Designer so the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: list controls and the CustomValidator
    ... Use can use the parent control to find the index. ... with CustomValidators in datagrids, I seem to recall some issues with ... Dim valCustomControl As New CustomValidator ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Trouble referencing controls within list controls
    ... Use can use the parent control to find the index. ... with CustomValidators in datagrids, I seem to recall some issues with ... Dim valCustomControl As New CustomValidator ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IE sequencing and cookie notification popups
    ... ' 10Apr04: accept cookies from hotmail. ... Dim SetWindowLong ' as object ... Const sDlgCaption = " Kookie Kruncher, ... ' notifications associated with that type of control. ...
    (microsoft.public.scripting.vbscript)