calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
The Button has the Click event which invokes a sub named 'SubmitPage'.
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
Sub SubmitPage(obj As Object, ea As EventArgs)
For each dgitem As DataGridItem in DataGrid1.Items
Dim lbl As Label=Nothing
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
Next
End Sub
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
<rn5a@.rediffmail.comwrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegr oups.com...
Quote:
Originally Posted by
>A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
>
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
>
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
>
The Button has the Click event which invokes a sub named 'SubmitPage'.
>
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
>
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
>
Thanks, Teemu...that's exactly what I was looking out for
Teemu Keiski wrote:
Quote:
Originally Posted by
You can't get DataGridItemEventArgs in SubmitPage (it is event argument data
type specific to a event, so it's not even wise to use as input to a
method), but you can loop through the DataGrid manually.
>
Sub SubmitPage(obj As Object, ea As EventArgs)
>
>
For each dgitem As DataGridItem in DataGrid1.Items
>
Dim lbl As Label=Nothing
>
If (dgitem.ItemType = ListItemType.Item Or dgitem.ItemType =
ListItemType.AlternatingItem) Then
lbl = dgitem.FindControl("lblAcre")
'Do something with the Label
End If
>
Next
>
End Sub
>
>
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
>
<rn5a@.rediffmail.comwrote in message
news:1165068166.263744.157190@.l12g2000cwl.googlegr oups.com...
Quote:
Originally Posted by
A Form has a DataGrid & a Button. The DataGrid's ItemDataBound event
calls a sub named 'BindData'. This sub first finds a Label which exists
in the ItemTemplate of the TemplateColumn of the DataGrid & does some
work with the Label.
Sub BindData(obj As Object, ea As DataGridItemEventArgs)
Dim lbl As Label
If (ea.Item.ItemType = ListItemType.Item Or ea.Item.ItemType =
ListItemType.AlternatingItem) Then
lbl = ea.Item.FindControl("lblAcre")
....
....
End If
End Sub
The Button has the Click event which invokes a sub named 'SubmitPage'.
Sub SubmitPage(obj As Object, ea As EventArgs)
....
End Sub
Now I did like the 'SubmitPage' sub to invoke the 'BindData' sub. How
do I accomplish this? In other words, what parameters do I pass from
the 'SubmitPage' sub to the 'BindData' sub which the latter expects?
0 comments:
Post a Comment