I have this code in the Pre Render event in one of my RadGrids.............For Each item As GridDataItem In Radgrid_AddRemoveProvider.MasterTableView.Items
Dim lblPID As Label = DirectCast(item.FindControl("lblPID"), Label)
Dim btnAddProvider As LinkButton = DirectCast(item.FindControl("btnAddProvider"), LinkButton)
Dim btnRemoveProvider As LinkButton = DirectCast(item.FindControl("btnRemoveProvider"), LinkButton)
Dim lblFullName As Label = DirectCast(item.FindControl("lblFullName"), Label)
Dim btnFullName As LinkButton = DirectCast(item.FindControl("btnFullName"), LinkButton)
' Dim lblContactType As Label = DirectCast(item.FindControl("lblContactType"), Label)
' Dim ddPreferredContact As DropDownList = DirectCast(item.FindControl("ddPreferredContact"), DropDownList)
If lblPID.Text = Nothing Then
btnAddProvider.Visible = True
'ddPreferredContact.Visible = True
'lblContactType.Visible = False
btnRemoveProvider.Visible = False
lblFullName.Visible = True
btnFullName.Visible = False
ElseIf lblPID.Text <> Nothing Then
btnAddProvider.Visible = False
'ddPreferredContact.Visible = False
'lblContactType.Visible = True
btnRemoveProvider.Visible = True
lblFullName.Visible = False
btnFullName.Visible = True
End If
Next
However it loops through this code 100 times looping through each item in my RadGrid. The problem is that it goes through this loop every time I perform any sort of event on the page. Is there anyway I can tell it to stop looping through this code when i am not working with this RadGrid on the page. I tried putting the code in the ItemCreated event, but it does the same thing. Overall I believe this is effecting the performance and speed of my page.