Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » ASP.NET » General » Downloads
Add your own
alternative version

Gridview inside Gridview in ASP.NET C#

, 9 Jun 2011
Gridview inside Gridview in ASP.NET C# or Nested Gridview and Update, Delete from Gridview
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NestedGridview.aspx.cs" Inherits="NestedGridview" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" 
        onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" 
        onrowupdating="GridView1_RowUpdating" OnRowCommand="GridView1_RowCommand">
        <asp:TemplateField HeaderText="Name">
         <asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
         <%--<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex%>'></asp:Label>--%>
         <asp:TemplateField HeaderText="A">
           <asp:Button ID="btnShow" runat="server" Text="Expand" CommandName="Show" CommandArgument='<%# Container.DataItemIndex%>' />
            <asp:TemplateField HeaderText="Name">
                <asp:Label ID="lbl" runat="server" Text='<%#Eval("emp_name") %>'></asp:Label>
                <asp:TextBox ID="txt" runat="server" Text='<%#Eval("emp_name") %>'></asp:TextBox>
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        AutoGenerateDeleteButton="False" AutoGenerateEditButton="False" >
         <asp:BoundField DataField="emp_address" HeaderText="emp_address" SortExpression="emp_address">
                            <ItemStyle Width="20%" />

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


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

About the Author

Software Developer India
India India
Total DotNet/Programming Solution
I am Prasanta Banerjee. I am an Asp.Net Developer. My site:
If any body wants to prepare for interview is the good site.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 9 Jun 2011
Article Copyright 2011 by Prasanta_Prince
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid