0
<asp:GridView ID="lvMainModule" GridLines="None" CssClass="gridviewShow" AutoGenerateColumns="false"
                                                    DataKeyNames="LinkMasterId"  OnRowDataBound="lvMainModule_ItemDataBound" runat="server">
                                                    <Columns>
                                                        <asp:TemplateField>
                                                            <ItemTemplate>
                                                                <asp:Label ID="ModuleNameLabel" runat="server" Font-Bold="true" Text='<%# Eval("LinkMasterType") %>' />
                                                                <asp:Label ID="LinkMasterId" runat="server" Visible="false" Text='<%# Eval("LinkMasterId") %>' />
                                                                <br />
                                                                <br />
                                                                <asp:GridView ID="lvSubModule" GridLines="None" OnRowEditing ="lvSubModule_RowEditing" CssClass="gridviewShow" AutoGenerateColumns="false"
                                                                    ShowHeader="false" DataKeyNames="Id" runat="server">
                                                                    <Columns>
                                                                     <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                                                                        <asp:TemplateField>
                                                                            <ItemTemplate>
                                                                                <asp:HyperLink name='<%# Eval("Link_ScrollId") %>' ID="subLink_Name" Text='<%# Eval("Link_Name") %>'
                                                                                    NavigateUrl='<%# Eval("Link_Url") %>' runat="server"></asp:HyperLink>
                                                                                <asp:Label ID="lblSubModuleCode" runat="server" Visible="false" Text='<%# Eval("Id")%>'></asp:Label>
                                                                                <br />
                                                                            </ItemTemplate>
                                                                            <EditItemTemplate>
                                                                                <asp:TextBox ID="txtLink_Name" runat="server" Text='<%#Bind("Link_Name") %>'>
                                                                                </asp:TextBox>
                                                                            </EditItemTemplate>
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                </asp:GridView>

Code Behind:-

 protected void lvSubModule_RowEditing(object sender, GridViewEditEventArgs e)
    {
        //GridView lvSub = (GridView)lvMainModule.Rows[e.NewEditIndex].FindControl("lvSubModule");

        //if (lvSub != null)
        //{
        //    lvSub.EditIndex = e.NewEditIndex;

        //}
        GridView gv = sender as GridView;
        gv.EditIndex = e.NewEditIndex;
        GetMainModules();

    }

Edited by Dani: Formatting fixed

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by |-|x
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.