none
Reterive Value from Repeater RRS feed

  • Question

  • I am using repeater to dispaly questions and there is one html button for comments on that particular question  which will open the modal window interface for them .And there is also repeater (basicaly there is nested repeater ) and  there it will must show comment for that particular question for which the button is click ,for that i need to fetch the label value which is in the parent repeater. so that i can use that label in my sql query for filtering the comment from comment table on the basis of q_id.

    If there is solution for that kindly plzzz help me out.I really got stuck here very badly.from last few days .

    Thanks!!.

    kindly plzzz send the solution at gautammittal23@gmail.com. Thanks !!!!

    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemCommand="Repeater1_ItemCommand">
    
             <HeaderTemplate>
                  <asp:Label ID="Label3" runat="server" Text="Excelent Solution For Your Problems" Font-Size="26" ForeColor="SlateBlue" Font-Underline="true"/>
                 <br /><br /><br />
              </HeaderTemplate>
    
            <ItemTemplate>
    
            <table>
                <tr>
                    <td colspan="3">
                        <asp:Label ID="Label3" runat="server" Text='<%#Eval("title")%>'  Font-Size="20" ForeColor="WhiteSmoke"/>
    <%--                   <asp:Label ID="Label10" runat="server" Text='<%#Eval("q_id") %>' />--%>
                        <asp:Label ID="Label11" runat="server" Text='<%#Eval("q_id") %>'></asp:Label>
                    </td>
                    <td>
                        <br />
                        <br />
                    </td>
                </tr>
                <tr>
                    <td>
                       <font color="Blue">Posted on :</font> 
                        <asp:Label ID="Label6" runat="server" Text='<%#Eval("post_date") %> ' Font-Size="10"  ForeColor="White" />
                    </td>
                </tr>
                <tr>
                    <td rowspan="3" colspan="3"><img src="q2.jpg" width="180" height="180" /></td>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td colspan="5">
                        <asp:Label ID="Label5" runat="server" Text='<%#Eval("question") %>' ForeColor="WhiteSmoke"/>
                    </td>
                    <td>&nbsp;&nbsp;&nbsp;</td>
                    <td>
    <%--                    <asp:Button ID="Button2" runat="server" Text="Read more"  BackColor="#3333FF" ForeColor="White" BorderStyle="None" />--%>
                        <button type="button" runat="server" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal1">Comments</button>
                    </td>
                </tr>
                <tr></tr>
                <tr></tr>
                <tr></tr>
            </table>
                <br /><br />
            </ItemTemplate>
            
            <AlternatingItemTemplate>
       <table>
                <tr>
                    <td colspan="3">
                        <asp:Label ID="Label3" runat="server" Text='<%#Eval("title")%>'  Font-Size="20" ForeColor="WhiteSmoke"/>
                        <asp:Label ID="Label11" runat="server" Text='<%#Eval("q_id") %>' />
                    </td>
                    <td>
                        <br />
                        <br />
                    </td>
                </tr>
                <tr>
                    <td>
                         <font color="Blue">Posted on :</font> 
                        <asp:Label ID="Label6" runat="server" Text='<%#Eval("post_date") %> ' Font-Size="10"  ForeColor="White" />
                    </td>
                </tr>
                <tr>
                    <td rowspan="3" colspan="3"><img src="q1.png" width="180" height="180" /></td>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td colspan="5">
                        <asp:Label ID="Label5" runat="server" Text='<%#Eval("question") %>' ForeColor="WhiteSmoke"/>
                    </td>
                    <td>&nbsp;&nbsp;&nbsp;</td>
                    <td>
    <%--                    <asp:Button ID="Button2" runat="server" Text="Read more"  BackColor="#3333FF" ForeColor="White" BorderStyle="None" />--%>
                    <button type="button" runat="server" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal1">Comments</button>
    
                    </td>
                </tr>
                <tr></tr>
                <tr></tr>
                <tr></tr>
            </table>
                <br /><br />
            </AlternatingItemTemplate>
                  
              </asp:Repeater>
    
    
    
    
    
    
    
    <%-- modal for comment--%>
             <div class="modal fade" id="myModal1" role="dialog">
        <div class="modal-dialog">
        
          <!-- Modal content-->
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">Comment</h4>
            </div>
            <div class="modal-body">
              <%--<p>Some text in the modal.</p>--%>
                <table>
                    <tr>
                        <th>
                            <asp:Label ID="Label7" runat="server" Text="Submit a Comment" Font-Size="XX-Large" ></asp:Label> 
                        </th>
                    </tr>
                    <tr>
                        <td>
                            <asp:TextBox ID="TextBox4" runat="server" MaxLength="500" TextMode="MultiLine" Columns="70" Rows="10"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Button ID="Button2" runat="server" Text="Submit" Font-Size="Larger" OnClick="Button2_Click" />
                        </td>
                    </tr>
                </table>
                <br />
                <br />
                <asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSource3">
                     <ItemTemplate>
                        <table>
                            <tr>
                                <td>
                                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/like.png" Width="20" /> 
                                    &nbsp; &nbsp; &nbsp; &nbsp;
                                     <asp:Label ID="Label10" runat="server" Text='<%#Eval("lke") %>' />
                                     &nbsp; &nbsp; &nbsp; &nbsp;
                                    <asp:ImageButton ID="ImageButton3" runat="server"  ImageUrl="~/dislike.png" Width="20"/>
                                     &nbsp; &nbsp; &nbsp; &nbsp;
                                </td>
                                <td>
                                    <asp:Label ID="Label9" runat="server" Text='<%#Eval("comment") %>' />
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:Repeater>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:majorConnectionString %>" SelectCommand="SELECT * FROM [book_c]">
                    <SelectParameters>
                        <asp:SessionParameter Name="q_id" SessionField="qid" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>

    • Moved by Sabah ShariqMVP Monday, May 1, 2017 7:54 PM Moved from Visual C#
    Monday, May 1, 2017 6:47 PM

All replies

  • You will find better support here https://forums.asp.net/ for ASP.NET questions.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, May 1, 2017 7:12 PM