[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Find Gridview within a Gridview/ItemTemplate within Table within Panel within CollapsablePanel

Posted on 2010-09-05
2
Medium Priority
?
626 Views
Last Modified: 2013-11-08
Hi,

I am in the process of designing forms and have not bound my grids yet, but can display 1 row of my grids using a simple procedure.
All of my grids are available in code behind except this one that is embedded into one of my grids.
I have tried the findcontrol and it always returns nothing.
The hierarchy of the form is
CollapsablePanel
   Panel
     Table
        Gridview
            ItemTemplate
               GridView       ***** Can't find this one

I am trying to find it in the Parent Grid Load Event


Protected Sub grdServiceDetails_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdServiceDetails.Load
          CheckGrid(Me.grdServiceDetails)
          Dim grd As GridView = DirectCast(grdServiceDetails.FindControl("grdProductsUsed"), GridView)
          If Not grd Is Nothing Then
               CheckGrid(grd)
          End If
     End Sub

Open in new window

0
Comment
Question by:Sheritlw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
karthitron earned 2000 total points
ID: 33609058
You want to access the grid view which resides in another grid view's Item Template. Then instead of directly getting the inner grid from parent grid, you have to iterate through each row in parent grid and find the inner grid in each row or each row's specific cell (for demonstating I used cell index as zero, you can specify the valid cell index otherwise simply you can use row object instead of cell object). Following is sample code:
Protected Sub GridView1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.Load
        For Each gvr As GridViewRow In GridView1.Rows
            Dim grd As GridView = DirectCast(gvr.FindControl("grdProductsUsed"), GridView)
            'Dim grd As GridView = DirectCast(gvr.Cells[0].FindControl(""), GridView)
            If Not grd Is Nothing Then
                CheckGrid(grd)
            End If
        Next
    End Sub

Open in new window

0
 

Author Closing Comment

by:Sheritlw
ID: 33613252
Thank you
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question