Tuesday 7 February 2012

nested grideview wtih tempory update,delete(source code)

<div dir="ltr" style="text-align: left;" trbidi="on">
<b>design code:</b>

&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %&gt;

&lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %&gt;



<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager id="sm" runat="server"></asp:scriptmanager>
<asp:updatepanel id="up" runat="server" updatemode="Conditional">
<contenttemplate>
<center>

<div style="width: 940px;">

<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">&nbsp;</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: center; width: 20px;">&nbsp;</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;">&nbsp;<asp:label id="lb" runat="server"></asp:label></li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">EID</li>




<li style="float: left; font-weight: bolder; list-style: none; padding-top: 3px; text-align: center; width: 20px;">:</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;"><asp:textbox id="tb" runat="server" width="100"></asp:textbox></li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">Name</li>




<li style="float: left; font-weight: bolder; list-style: none; padding-top: 3px; text-align: center; width: 20px;">:</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;"><asp:textbox id="tb1" runat="server" width="200"></asp:textbox></li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">Department</li>




<li style="float: left; font-weight: bolder; list-style: none; padding-top: 3px; text-align: center; width: 20px;">:</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;"><asp:dropdownlist id="ddl" runat="server" width="200"></asp:dropdownlist>&nbsp;<asp:button id="btn1" onclick="btn1_Click" runat="server" text="Add More" width="80"></asp:button></li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">&nbsp;</li>




<li style="float: left; font-weight: 900; list-style: none; padding-top: 3px; text-align: center; width: 20px;">&nbsp;</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;">&nbsp;<asp:gridview datakeynames="did" id="gv" onrowcancelingedit="gv_RowCancelingEdit" onrowdeleting="gv_RowDeleting" onrowediting="gv_RowEditing" onrowupdating="gv_RowUpdating" runat="server" width="100%">
<columns>
<asp:commandfield headertext="UPDATE" showeditbutton="True" showheader="True">
<asp:commandfield headertext="DELETE" showdeletebutton="True" showheader="True">
</asp:commandfield></asp:commandfield></columns>
</asp:gridview></li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">&nbsp;</li>




<li style="float: left; font-weight: 900; list-style: none; padding-top: 3px; text-align: center; width: 20px;">&nbsp;</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;">
<asp:button id="btn" onclick="btn_Click" runat="server" text="Save" width="80"></asp:button></li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: right; width: 360px;">&nbsp;</li>




<li style="float: left; font-weight: 900; list-style: none; padding-top: 3px; text-align: center; width: 20px;">&nbsp;</li>




<li style="float: left; list-style: none; padding-top: 3px; text-align: left; width: 560px;">
<asp:gridview autogeneratecolumns="False" cellpadding="4" forecolor="#333333" gridlines="None" id="gv1" runat="server" width="100%">
<alternatingrowstyle backcolor="White">
<columns>
<asp:templatefield>
<headertemplate>
<table style="width: 501pxpx;">
<tr><th style="width: 167px;">SELECT</th><th style="width: 167px;">EID</th><th style="width: 167px;">NAME</th></tr>
</table>
</headertemplate>
<itemtemplate>
<table style="width: 501pxpx;">
<tr><td style="width: 167px;">
<asp:panel id="pn" runat="server">
<asp:imagebutton commandargument="&lt;%#Eval(&quot;eid&quot;) %&gt;" id="im" onclick="im_Click" runat="server">
</asp:imagebutton></asp:panel>
<asp:collapsiblepanelextender collapsecontrolid="pn" collapsed="true" collapsedimage="~/plus.png" expandcontrolid="pn" expandedimage="~/minus.png" id="CollapsiblePanelExtender1" imagecontrolid="im" runat="server" targetcontrolid="pn1">
</asp:collapsiblepanelextender>
</td><td style="width: 167px;">&lt;%#Eval("eid") %&gt;</td><td style="width: 167px;">&lt;%#Eval("name") %&gt;</td></tr>
<tr><td colspan="3" style="width: 501px;">
<asp:panel id="pn1" runat="server">
<asp:gridview gridlines="None" headerstyle-horizontalalign="Center" id="gv2" rowstyle-horizontalalign="Left" runat="server" width="100%">

</asp:gridview>
</asp:panel>
</td></tr>
</table>
</itemtemplate>
</asp:templatefield>
</columns>

</alternatingrowstyle></asp:gridview></li>




</div>
</center>

</contenttemplate>
</asp:updatepanel>
</form>
</body>
</html></div>

No comments:

Post a Comment