|
 |
aspx thread: Difference between "Me.datagrid.Items(i).FindControl" and "e.item.FindControl"?
Message #1 by "Oliver Vogt" <saturnius@g...> on Mon, 27 Jan 2003 21:49:50
|
|
'Sub submitItem(ByVal Sender As Object, ByVal E As
DataGridCommandEventArgs)
'If E.CommandName = "submit" Then
'Dim i As Integer
'Dim cbSelection As New CheckBox()
''
''*****
''If I change : Me.dgWorkItem.FindControl("chkWorkItemAll"), CheckBox
''against : e.item.FindControl("chkWorkItemAll"), CheckBox it
works !!!!
''*****
''
''The following three items are part of the Datagrid footer
'Dim cbAllItem As CheckBox= (CType(Me.dgWorkItem.FindControl
("chkWorkItemAll"), CheckBox))
'Dim txtAllItemQuantity As TextBox = (CType(Me.dgWorkItem.FindControl
("tbWorkItemQuantityAll"), TextBox))
'Dim calAllItemDate As Calendar = (CType(Me.dgWorKItem.FindControl
("calworkItemDate"), Calendar))
''
'sqlConn.Open()
'For i = 0 To (Me.dgWorkItem.Items.Count - 1)
'cbSelection = CType(Me.dgWorkItem.Items(i).FindControl("chkWorkItem"),
CheckBox)
'If ((cbAllItem = True) Or (cbSelection.Checked = True)) Then
'Dim cmdWork As New SqlCommand("submititem", sqlConn)
'cmdWork.CommandType = CommandType.StoredProcedure
'cmdWorkflow.Parameters.Add(New SqlParameter("@identifier",
SqlDbType.Char, 50)).Value = (CType(Me.dgWorkItem.Items(i).FindControl
("lblidentifier"), Label)).Text
''
''In the line above I can access "Me.dgWorkItem.Items(i).FindControl
("lblidentifier")" and I don't have to replace "Me.dgWorkItem"
with "e.item"
''The reason why I have to do this is because I want to re-use the code
above in a way like
''
''Sub submitItem(ByVal Sender As Object, ByVal E As
DataGridCommandEventArgs)
'' submittheselecteditems()
''end sub
''
''sub submittheselecteditems()
'' here goes the complete code to re-use
''end sub
''
''What is the difference between "Me.dgWorkItem" and "e.item"? How can I
access the items in the datgrid footer?
''Many thanks in advance!
''Cheers.
Message #2 by "Rohit Arora" <rohit_arora@i...> on Tue, 28 Jan 2003 11:38:01 +0530
|
|
u are using small e, while datagridcommandeventargs has capital E. I don't
know if it makes diffrence in vb.net but it surely does make in c#.
peace
rohit
-----Original Message-----
From: Oliver Vogt [mailto:saturnius@g...]
Sent: Monday, January 27, 2003 9:50 PM
To: ASP.NET
Subject: [aspx] Difference between "Me.datagrid.Items(i).FindControl"
and "e.item.FindControl"?
'Sub submitItem(ByVal Sender As Object, ByVal E As
DataGridCommandEventArgs)
'If E.CommandName = "submit" Then
'Dim i As Integer
'Dim cbSelection As New CheckBox()
''
''*****
''If I change : Me.dgWorkItem.FindControl("chkWorkItemAll"), CheckBox
''against : e.item.FindControl("chkWorkItemAll"), CheckBox it
works !!!!
''*****
''
''The following three items are part of the Datagrid footer
'Dim cbAllItem As CheckBox= (CType(Me.dgWorkItem.FindControl
("chkWorkItemAll"), CheckBox))
'Dim txtAllItemQuantity As TextBox = (CType(Me.dgWorkItem.FindControl
("tbWorkItemQuantityAll"), TextBox))
'Dim calAllItemDate As Calendar = (CType(Me.dgWorKItem.FindControl
("calworkItemDate"), Calendar))
''
'sqlConn.Open()
'For i = 0 To (Me.dgWorkItem.Items.Count - 1)
'cbSelection = CType(Me.dgWorkItem.Items(i).FindControl("chkWorkItem"),
CheckBox)
'If ((cbAllItem = True) Or (cbSelection.Checked = True)) Then
'Dim cmdWork As New SqlCommand("submititem", sqlConn)
'cmdWork.CommandType = CommandType.StoredProcedure
'cmdWorkflow.Parameters.Add(New SqlParameter("@identifier",
SqlDbType.Char, 50)).Value = (CType(Me.dgWorkItem.Items(i).FindControl
("lblidentifier"), Label)).Text
''
''In the line above I can access "Me.dgWorkItem.Items(i).FindControl
("lblidentifier")" and I don't have to replace "Me.dgWorkItem"
with "e.item"
''The reason why I have to do this is because I want to re-use the code
above in a way like
''
''Sub submitItem(ByVal Sender As Object, ByVal E As
DataGridCommandEventArgs)
'' submittheselecteditems()
''end sub
''
''sub submittheselecteditems()
'' here goes the complete code to re-use
''end sub
''
''What is the difference between "Me.dgWorkItem" and "e.item"? How can I
access the items in the datgrid footer?
''Many thanks in advance!
''Cheers.
|
|
 |