View Single Post
  #1 (permalink)  
Old November 15th, 2006, 10:17 PM
KamalRaturi KamalRaturi is offline
Authorized User
 
Join Date: Aug 2006
Location: delhi, delhi, India.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to KamalRaturi Send a message via Yahoo to KamalRaturi
Default four Nested gridviews with data

hi ,

I use bound four Nested gridviews with data in .aspx page using template field. The Innermost grid rows do have IDs of products in hiddenfield value and a checkbox for each value,when user checks the selected checkboxes, and click the submit button I do not know how a string can be made with these IDs.

I tried at my level but.......

the code and Error is:

For Each gRow1 In GridView1.Rows
            If CType(gRow1.TemplateControl.FindControl("gridview2 "), GridView).HasControls Then
//err here// gdView = CType(gRow1.TemplateControl.FindControl("gridview2 "), GridView)
                MsgBox("G1")
                For Each gRow2 In gdView.Rows
                    If CType(gRow1.FindControl("gridview3"), GridView).HasAttributes Then
                        gdView = CType(gRow1.FindControl("gridview3"), GridView)
                        For Each gRow3 In gdView.Rows
                            If CType(gRow1.FindControl("gridview4"), GridView).HasAttributes Then
                                gdView = CType(gRow1.FindControl("gridview4"), GridView)
                                For Each gRow4 In gdView.Rows
                                    chkTitle = CType(gRow4.FindControl("ckSelect"), CheckBox)
                                    If chkTitle.Checked = True Then
                                        ifAnyChecked = True
                                        hdnValue = CType(gRow4.FindControl("hdnQuestionID"), HiddenField)
                                        If strID = "" Then
                                            strID = strID & hdnValue.Value
                                        Else
                                            strID = strID & "," & hdnValue.Value
                                        End If
                                    End If
                                Next
                            End If
                        Next
                    End If
                Next
            End If
        Next
        MsgBox(strID)



Error:Object reference not set to an instance of an object.


Please Tell me Solution if U know, Thanks in Advance.