I have been trying to find a grdiview control dynamically with variable gridview names. I have a page with 3 gridviews each has a unique id determined by an integer in string name of the gridview. I am trying to find this grid view with the following code.
The names of the gridviews in the asp.net page are Layer1GridView, Layer2GridView, etc. I need to access these gridview in page load in vb.net to assign values to the columns. The below code is not working. Can someone help me with this?
Thanks in advance.
Dim GridName As String
GridName = "Layer" & LayerNumber & "GridView"
Dim NewGrid As WebControls.GridView = DirectCast(Me.FindControl(GridName), WebControls.GridView)
Going through this procedure the NewGrid is nothing.