|
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NestedGridview.aspx.cs" Inherits="NestedGridview" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
onrowcancelingedit="GridView1_RowCancelingEdit"
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
onrowupdating="GridView1_RowUpdating" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
<%--<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex%>'></asp:Label>--%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="A">
<ItemTemplate>
<asp:Button ID="btnShow" runat="server" Text="Expand" CommandName="Show" CommandArgument='<%# Container.DataItemIndex%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lbl" runat="server" Text='<%#Eval("emp_name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txt" runat="server" Text='<%#Eval("emp_name") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
AutoGenerateDeleteButton="False" AutoGenerateEditButton="False" >
<Columns>
<asp:BoundField DataField="emp_address" HeaderText="emp_address" SortExpression="emp_address">
<ItemStyle Width="20%" />
</asp:BoundField>
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
|
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.