wsyeager
Centurion
I have a datalist that displays the following when a web page is rendered:
Community_Property: 2 | Corporation: 5 | Custodian: 10 | Individual: 138 | Joint: 82 |
Tenants_By_Entirety: 0 | Tenants_In_Common: 1 | Trust: 82
Each of the text items above is a linkbutton. However, I want to disable the linkbutton if the count is zero. Hence, I have the following code in my DataList1.ItemDataBound event:
Dim lblCount As Label = DirectCast(e.Item.FindControl("lblCount"), Label)
Dim lbtnReg2 As LinkButton = DirectCast(e.Item.FindControl("lbtnReg2"), LinkButton)
If lblCount.Text = 0 Then
lbtnReg2.Enabled = False
End If
The first time thru, it works fine. The second time thru, I get the "Object not set to an instance of an object" err msg. I thought for every item in the datalist, this event fires. How come it works for the first record, but not subsequent records?
btw, the RepeatDirection is set to Horizontal and the RepeatColumns is 5...
I'd appreciate any help...
Community_Property: 2 | Corporation: 5 | Custodian: 10 | Individual: 138 | Joint: 82 |
Tenants_By_Entirety: 0 | Tenants_In_Common: 1 | Trust: 82
Each of the text items above is a linkbutton. However, I want to disable the linkbutton if the count is zero. Hence, I have the following code in my DataList1.ItemDataBound event:
Dim lblCount As Label = DirectCast(e.Item.FindControl("lblCount"), Label)
Dim lbtnReg2 As LinkButton = DirectCast(e.Item.FindControl("lbtnReg2"), LinkButton)
If lblCount.Text = 0 Then
lbtnReg2.Enabled = False
End If
The first time thru, it works fine. The second time thru, I get the "Object not set to an instance of an object" err msg. I thought for every item in the datalist, this event fires. How come it works for the first record, but not subsequent records?
btw, the RepeatDirection is set to Horizontal and the RepeatColumns is 5...
I'd appreciate any help...