Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I m having a gridview with simple student information.
This gridview having a column of link button which generates Grid_rowcommand method().
But when I click on that link button, i need to have a row right under the selected row only with Textbox in which i can write some text and can send this reply as email to perticaular student.
XML
<asp:GridView ID="grdSuggestion" runat="server" AutoGenerateColumns="false" DataKeyNames=""
                    AllowPaging="True" PageSize="10" Width="100%"
                    onrowdatabound="grdSuggestion_RowDataBound"
                    onrowcommand="grdSuggestion_RowCommand" >
                    <HeaderStyle HorizontalAlign="Center" CssClass="GridHeaderClass" />
                    <PagerStyle BackColor="#3B5998" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle HorizontalAlign="Left" CssClass="GridRowClass" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle CssClass="GridalternetRowClass" ForeColor="#284775" />
                    <FooterStyle CssClass="GridFooterClass" />
                    <Columns>

                        <asp:TemplateField HeaderText="Faculty" ItemStyle-Width="10%">
                            <ItemTemplate>
                                <asp:Label ID="lblfaculty" runat="server" Text='<%# Eval("faculty") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Time" ItemStyle-Width="10%">
                            <ItemTemplate>
                                <asp:Label ID="lbltime" runat="server" Text='<%# Eval("time") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Course" ItemStyle-Width="15%">
                            <ItemTemplate>
                                <asp:Label ID="lblcourse" runat="server" Text='<%# Eval("coursename") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Student" ItemStyle-Width="12%">
                            <ItemTemplate>
                                <asp:Label ID="lblStudname" runat="server" Text='<%# Eval("name") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
<asp:TemplateField HeaderText="Solution" ItemStyle-Width="15%">
                            <ItemTemplate>
                              <asp:LinkButton ID="lnkReply" runat="server" Text="Reply" CommandName="Reply"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>




coding side :


C#
protected void grdSuggestion_RowCommand(object sender, GridViewCommandEventArgs e)
   {
       GridViewRow gvRow = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
       int RowIndex = gvRow.RowIndex;
       if (e.CommandName == "Reply")
       {
           ///Need Code Here to show Dynamic data panel
       }
   }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900