Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

row.Findcontrol not working!

$
0
0
Could anyone tell me why this does not work? The events seem to find it just fine - like in the RowDataBound event as the right ones show up checked. I call this sub with the RowUpdated event. All the other controls in this row are also found in both events and in this sub.

'html markup inside the TemplateField
<asp:CheckBox ID="cbWeight" runat="server" Checked='<%# Eval("WeightBased") %>' Enabled="false" />


'code behind file
Public Sub DoMath()
 For row As Integer = 0 To gvW.Rows.Count -1
  Dim cb As CheckBox = TryCast(gvW.Rows(row).FindControl("cbWeight"), CheckBox)
  If not cb Is Nothing Then 
    'it always shows as Nothing
    'also does not work
    'gvW.Rows(row).Cells(7).FindControl("cbWeight")
  End If
  'other code deleted for simplicity and cause this is the only part not working
 Next
End Sub


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>