What are you exporting. GridViews or a Panel which has the Gridviews
I would suggest if you need GridView1 export GridView1 . You can create a generic function
Export(gw as GridView);
And pass the GridView to be exported as paramater
If Session("PendingClaims") = True
Export(GridView1)
else
Export(GridView2)
End If