Link to home
Start Free TrialLog in
Avatar of naeembhatti
naeembhattiFlag for United States of America

asked on

getting error in nested grid view control

hi guys i am getting problem in nested grid view

<asp:GridView ID="GridViewCategory"
        CellSpacing="2" ForeColor="#42301c" Font-Bold="true" Width="940px" GridLines="None"
         AllowPaging="True"
         OnRowDataBound="InnerGridViewLessons_RowDataBound"
         DataKeyNames="QuestionSubjectID"
        AutoGenerateColumns="False" runat="server" BackColor="White"
         BackImageUrl="images/hdngbar_lc.jpg" CellPadding="4">
    <Columns>                                
        <asp:TemplateField HeaderText="Subject Name" >
            <ItemTemplate>
                <asp:Label runat="server" id="lblQuestionSubjectDesc" Font-Bold="True" Text=<%#Eval("QuestionSubjectDesc")%>></asp:Label>
               
                  <asp:GridView ID="InnerGridViewLessons" runat="server" CellPadding="4" Width="100%"                      
                       
                       BorderStyle="Solid" BorderWidth="1px" Font-Size="8pt"
                       BorderColor="#336699" GridLines="Horizontal">
                       <HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" />
                   </asp:GridView>
                             
            </ItemTemplate>
       <%-- <asp:BoundField DataField="QuestionSubjectDesc" HeaderText="Subject Name"  SortExpression="QuestionSubjectDesc" ShowHeader="False"  />--%>
        </asp:TemplateField>                            
         
    </Columns>
   
    <EmptyDataRowStyle CssClass="headingtitle" />
    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" />
    <RowStyle BackColor="#F7F6F3" Font-Names="verdana" Font-Size="10pt" HorizontalAlign="Left"         />
    <EditRowStyle BackColor="#999999" />
    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" />
    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />    
    <AlternatingRowStyle BackColor="#F7F6F3"  />
    </asp:GridView>

-----------------------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim Query_questionSubjects = From t In dbINAP.PEN_QuestionSubjects _
                                     Where t.QuestionSubjectDesc <> "General" _
                                     Select _
                                      t.QuestionSubjectDesc, _
                                      t.QuestionSubjectID

        GridViewCategory.DataSource = Query_questionSubjects
        GridViewCategory.DataBind()
        GridViewCategory.HeaderRow.Visible = False



    End Sub

Protected Sub InnerGridViewLessons_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewCategory.RowDataBound

        Dim gv As New GridView()

        gv = e.Row.FindControl("InnerGridViewLessons")

        If e.Row.DataItem Is Nothing Then
            Return
        End If
       

        If e.Row.RowType = DataControlRowType.DataRow Then


            Dim tmpstr As String = Left(e.Row.DataItem("SubSysCode").ToString, 3)

            Dim dbSrc = From t In dbINAP.Pen_Answers _
                                 Select _
                                  t.Answer

            gv.DataSource = dbSrc
            gv.DataBind()
        End If


    End Sub


please help me out i am unable to solve it

Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

You haven't told us what the problem is!

Are you getting an error, incorrect data, no data, or something else?
Avatar of naeembhatti

ASKER

Exception Details: System.MissingMemberException: No default member found for type 'VB$AnonymousType_49(Of String,String)'.
Source Error:
Line 44:         Dim strSort As String = String.Empty
Line 45:
Line 46:         Dim gv As New GridView()
Line 47:         gv = e.Row.FindControl("InnerGridViewLessons")

 
i want to get questionsubjectID from the 1st gridview
and then get results to other nested grid view
but getting problem
ASKER CERTIFIED SOLUTION
Avatar of naeembhatti
naeembhatti
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial