Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.53 KB | None | 0 0
  1. <table>
  2. <tr>
  3. <asp:GridView ID="GridView2" runat="server" AllowPaging="True"
  4. AutoGenerateColumns="False"
  5. BackColor="#DEBA84" BorderColor="#DEBA84"
  6. BorderStyle="None" BorderWidth="1px"
  7. CellPadding="3" CellSpacing="2"
  8. DataSourceID="SqlDataSource1" PageSize="6"
  9. DataKeyNames="MachID">
  10. <Columns>
  11. <asp:CommandField ShowSelectButton="True" />
  12. <asp:BoundField DataField="EmpCode" HeaderText="Emp Code" SortExpression="EmpCode" />
  13. <asp:BoundField DataField="Name" HeaderText="Firstname" SortExpression="Name" />
  14. <asp:BoundField DataField="CompanyName" HeaderText="Company" SortExpression="CompanyName" />
  15. <asp:BoundField DataField="DeptName" HeaderText="Department" SortExpression="DeptName" />
  16. <asp:BoundField DataField="Desgname" HeaderText="Designation" SortExpression="Desgname" />
  17. <asp:BoundField DataField="Postname" HeaderText="Post" SortExpression="Postname" />
  18. <asp:BoundField DataField="BranchName" HeaderText="Branch" SortExpression="BranchName" />
  19. <asp:TemplateField>
  20. <ItemTemplate>
  21. <asp:Button ID="btnViewMore" runat="server"
  22. Text="ViewMore" onclick="btnViewMore_Click" />
  23. </ItemTemplate>
  24. </asp:TemplateField>
  25. </Columns>
  26. <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
  27. <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
  28. <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
  29. <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
  30. <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
  31. <SortedAscendingCellStyle BackColor="#FFF1D4" />
  32. <SortedAscendingHeaderStyle BackColor="#B95C30" />
  33. <SortedDescendingCellStyle BackColor="#F1E5CE" />
  34. <SortedDescendingHeaderStyle BackColor="#93451F" />
  35. </asp:GridView>
  36. <asp:Button ID="btnShowPopup" runat="server" style="display:none;"/>
  37. <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1"
  38. TargetControlID="btnShowPopup" PopupControlID="Panel1"
  39. CancelControlID="btnClose"
  40. BackgroundCssClass="modalBackground" runat="server">
  41. </ajaxToolkit:ModalPopupExtender>
  42.  
  43. <asp:SqlDataSource ID="SqlDataSource1" runat="server"
  44. ConnectionString="<%$ ConnectionStrings:ManjilasConnectionString2 %>"
  45. SelectCommand="SELECT [EmpCode], [CompanyName], [DeptName], [Desgname], [Postname], [Name], [BranchName], [MachID] FROM [View_EmpDetailsPopup]">
  46. </asp:SqlDataSource>
  47. </tr>
  48. </table>
  49.  
  50. <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server">
  51. </ajaxToolkit:ToolkitScriptManager>
  52.  
  53. <asp:Panel ID="Panel1" runat="server" CssClass="Popup" align="center" style = "display:none">
  54. <table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%" cellpadding="30" cellspacing="10">
  55. <tr style="background-color:white">
  56. <td colspan="2" style=" height:10%; color:black; font-weight:bold;
  57. font-size:larger" align="center">
  58. <asp:DetailsView ID="DetailsView1" runat="server"
  59. Height="50px" Width="200px" AutoGenerateRows="False">
  60. <Fields>
  61. <asp:BoundField DataField="EmpCode" HeaderText="EmpCode" />
  62. <asp:BoundField DataField="Jndate" HeaderText="Jdate" />
  63. <asp:BoundField DataField="StatusName" HeaderText="Status" />
  64. <asp:BoundField DataField="TypeName" HeaderText="Employee Type" />
  65. <asp:BoundField DataField="ContractPeriod" HeaderText="Contract Period" />
  66. <asp:BoundField DataField="CompanyName" HeaderText="Company" />
  67. <asp:BoundField DataField="DeptName" HeaderText="Department" />
  68. <asp:BoundField DataField="Postname" HeaderText="Post" />
  69. <asp:BoundField DataField="sectname" HeaderText="Section" />
  70. <asp:BoundField DataField="Desgname" HeaderText="Designation" />
  71. <asp:BoundField DataField="MgrCode" HeaderText="Manger Code" />
  72. <asp:BoundField DataField="ot" HeaderText="OT" />
  73. <asp:BoundField DataField="pf" HeaderText="PF" />
  74. <asp:BoundField DataField="esi" HeaderText="ESI" />
  75. <asp:BoundField DataField="TDS" HeaderText="TDS" />
  76. <asp:BoundField DataField="Nominee" HeaderText="Nominee" />
  77. <asp:BoundField DataField="groupname" HeaderText="Employee Group" />
  78. <asp:BoundField DataField="Name" HeaderText="Name" />
  79. <asp:BoundField DataField="Shiftname" HeaderText="Shift" />
  80. <asp:BoundField DataField="OffDayName" HeaderText="Offday" />
  81. <asp:BoundField DataField="BranchName" HeaderText="Branch" />
  82. <asp:BoundField DataField="Category" HeaderText="Category" />
  83. <asp:BoundField DataField="UserType" HeaderText="User Type" />
  84. </Fields>
  85. <PagerSettings PageButtonCount="5" />
  86. </asp:DetailsView>
  87. </td>
  88. </tr>
  89. </table>
  90. <br/>
  91. <asp:Button ID="btnClose" runat="server" Text="Back" />
  92.  
  93. protected void btnViewMore_Click(object sender, EventArgs e)
  94. {
  95. Button btndetails = sender as Button;
  96. GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
  97. string MachID = GridView2.DataKeys[gvrow.RowIndex].Value.ToString();
  98. Session["MachIdgrid"] = MachID.ToString();
  99.  
  100. GetDatBind(MachID);
  101.  
  102. this.ModalPopupExtender1.Show();
  103. }
  104.  
  105. private void GetDatBind(string EmpID)
  106. {
  107. DataTable dt = new DataTable();
  108. DataTable dt1 = new DataTable();
  109.  
  110. qry = "select Photo,EmpCode,Convert(varchar(10), Jndate, 126) as Jndate, StatusName, TypeName, ContractPeriod, CompanyName, DeptName, Postname, sectname, Desgname, MgrCode from View_EmpDetailsPopup where MachID='" + EmpID + "'";
  111. dt.Clear();
  112. dt = conn.gettable(qry);
  113.  
  114. qry = "select ot, pf, esi, TDS, Nominee, groupname, Name, Shiftname, OffDayName, BranchName, Category, UserType from View_EmpDetailsPopup where MachID='" + EmpID + "'";
  115.  
  116. dt1.Clear();
  117. dt1 = conn.gettable(qry);
  118.  
  119. if (dt1.Rows.Count > 0)
  120. {
  121. if (dt1.Rows[0].ItemArray[1].ToString() == "1")
  122. {
  123. for (int i = 0; i < 5; i++)
  124. {
  125. if (dt1.Rows[0].ItemArray[i].ToString() == "1")
  126. {
  127. string column = dt1.Columns[i].ColumnName.ToString();
  128. dt1.Columns.RemoveAt(i);
  129. DataColumn Col = dt1.Columns.Add(column, typeof(string));
  130. Col.SetOrdinal(i);
  131. dt1.Columns[column].Expression = "'Yes'";
  132. }
  133. else
  134. {
  135. string column = dt1.Columns[i].ColumnName.ToString();
  136. dt1.Columns.RemoveAt(i);
  137. DataColumn Col = dt1.Columns.Add(column, typeof(string));
  138. Col.SetOrdinal(i);
  139. dt1.Columns[column].Expression = "'No'";
  140. }
  141. }
  142.  
  143. GridView1.DataSource = dt;
  144. GridView1.DataBind();
  145.  
  146. DetailsView2.DataSource = dt1;
  147. DetailsView2.DataBind();
  148.  
  149. DetailsView1.DataSource = dt;
  150. DetailsView1.DataBind();
  151. }
  152. }
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement