naeembhatti
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="InnerGridV iewLessons _RowDataBo und"
DataKeyNames="QuestionSubj ectID"
AutoGenerateColumns="False " runat="server" BackColor="White"
BackImageUrl="images/hdngb ar_lc.jpg" CellPadding="4">
<Columns>
<asp:TemplateField HeaderText="Subject Name" >
<ItemTemplate>
<asp:Label runat="server" id="lblQuestionSubjectDesc " Font-Bold="True" Text=<%#Eval("QuestionSubj ectDesc")% >></asp:La bel>
<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="QuestionSubject Desc" HeaderText="Subject Name" SortExpression="QuestionSu bjectDesc" 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_QuestionSubject s _
Where t.QuestionSubjectDesc <> "General" _
Select _
t.QuestionSubjectDesc, _
t.QuestionSubjectID
GridViewCategory.DataSourc e = Query_questionSubjects
GridViewCategory.DataBind( )
GridViewCategory.HeaderRow .Visible = False
End Sub
Protected Sub InnerGridViewLessons_RowDa taBound(By Val sender As Object, ByVal e As System.Web.UI.WebControls. GridViewRo wEventArgs ) Handles GridViewCategory.RowDataBo und
Dim gv As New GridView()
gv = e.Row.FindControl("InnerGr idViewLess ons")
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("SubSy sCode").To String, 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
<asp:GridView ID="GridViewCategory"
CellSpacing="2" ForeColor="#42301c" Font-Bold="true" Width="940px" GridLines="None"
AllowPaging="True"
OnRowDataBound="InnerGridV
DataKeyNames="QuestionSubj
AutoGenerateColumns="False
BackImageUrl="images/hdngb
<Columns>
<asp:TemplateField HeaderText="Subject Name" >
<ItemTemplate>
<asp:Label runat="server" id="lblQuestionSubjectDesc
<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="QuestionSubject
</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_QuestionSubject
Where t.QuestionSubjectDesc <> "General" _
Select _
t.QuestionSubjectDesc, _
t.QuestionSubjectID
GridViewCategory.DataSourc
GridViewCategory.DataBind(
GridViewCategory.HeaderRow
End Sub
Protected Sub InnerGridViewLessons_RowDa
Dim gv As New GridView()
gv = e.Row.FindControl("InnerGr
If e.Row.DataItem Is Nothing Then
Return
End If
If e.Row.RowType = DataControlRowType.DataRow
Dim tmpstr As String = Left(e.Row.DataItem("SubSy
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
ASKER
Exception Details: System.MissingMemberExcept ion: 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("InnerGr idViewLess ons")
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("InnerGr
ASKER
i want to get questionsubjectID from the 1st gridview
and then get results to other nested grid view
but getting problem
and then get results to other nested grid view
but getting problem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you getting an error, incorrect data, no data, or something else?