Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table>
- <tr>
- <asp:GridView ID="GridView2" runat="server" AllowPaging="True"
- AutoGenerateColumns="False"
- BackColor="#DEBA84" BorderColor="#DEBA84"
- BorderStyle="None" BorderWidth="1px"
- CellPadding="3" CellSpacing="2"
- DataSourceID="SqlDataSource1" PageSize="6"
- DataKeyNames="MachID">
- <Columns>
- <asp:CommandField ShowSelectButton="True" />
- <asp:BoundField DataField="EmpCode" HeaderText="Emp Code" SortExpression="EmpCode" />
- <asp:BoundField DataField="Name" HeaderText="Firstname" SortExpression="Name" />
- <asp:BoundField DataField="CompanyName" HeaderText="Company" SortExpression="CompanyName" />
- <asp:BoundField DataField="DeptName" HeaderText="Department" SortExpression="DeptName" />
- <asp:BoundField DataField="Desgname" HeaderText="Designation" SortExpression="Desgname" />
- <asp:BoundField DataField="Postname" HeaderText="Post" SortExpression="Postname" />
- <asp:BoundField DataField="BranchName" HeaderText="Branch" SortExpression="BranchName" />
- <asp:TemplateField>
- <ItemTemplate>
- <asp:Button ID="btnViewMore" runat="server"
- Text="ViewMore" onclick="btnViewMore_Click" />
- </ItemTemplate>
- </asp:TemplateField>
- </Columns>
- <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
- <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
- <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
- <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
- <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
- <SortedAscendingCellStyle BackColor="#FFF1D4" />
- <SortedAscendingHeaderStyle BackColor="#B95C30" />
- <SortedDescendingCellStyle BackColor="#F1E5CE" />
- <SortedDescendingHeaderStyle BackColor="#93451F" />
- </asp:GridView>
- <asp:Button ID="btnShowPopup" runat="server" style="display:none;"/>
- <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1"
- TargetControlID="btnShowPopup" PopupControlID="Panel1"
- CancelControlID="btnClose"
- BackgroundCssClass="modalBackground" runat="server">
- </ajaxToolkit:ModalPopupExtender>
- <asp:SqlDataSource ID="SqlDataSource1" runat="server"
- ConnectionString="<%$ ConnectionStrings:ManjilasConnectionString2 %>"
- SelectCommand="SELECT [EmpCode], [CompanyName], [DeptName], [Desgname], [Postname], [Name], [BranchName], [MachID] FROM [View_EmpDetailsPopup]">
- </asp:SqlDataSource>
- </tr>
- </table>
- <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server">
- </ajaxToolkit:ToolkitScriptManager>
- <asp:Panel ID="Panel1" runat="server" CssClass="Popup" align="center" style = "display:none">
- <table width="100%" style="border:Solid 3px #D55500; width:100%; height:100%" cellpadding="30" cellspacing="10">
- <tr style="background-color:white">
- <td colspan="2" style=" height:10%; color:black; font-weight:bold;
- font-size:larger" align="center">
- <asp:DetailsView ID="DetailsView1" runat="server"
- Height="50px" Width="200px" AutoGenerateRows="False">
- <Fields>
- <asp:BoundField DataField="EmpCode" HeaderText="EmpCode" />
- <asp:BoundField DataField="Jndate" HeaderText="Jdate" />
- <asp:BoundField DataField="StatusName" HeaderText="Status" />
- <asp:BoundField DataField="TypeName" HeaderText="Employee Type" />
- <asp:BoundField DataField="ContractPeriod" HeaderText="Contract Period" />
- <asp:BoundField DataField="CompanyName" HeaderText="Company" />
- <asp:BoundField DataField="DeptName" HeaderText="Department" />
- <asp:BoundField DataField="Postname" HeaderText="Post" />
- <asp:BoundField DataField="sectname" HeaderText="Section" />
- <asp:BoundField DataField="Desgname" HeaderText="Designation" />
- <asp:BoundField DataField="MgrCode" HeaderText="Manger Code" />
- <asp:BoundField DataField="ot" HeaderText="OT" />
- <asp:BoundField DataField="pf" HeaderText="PF" />
- <asp:BoundField DataField="esi" HeaderText="ESI" />
- <asp:BoundField DataField="TDS" HeaderText="TDS" />
- <asp:BoundField DataField="Nominee" HeaderText="Nominee" />
- <asp:BoundField DataField="groupname" HeaderText="Employee Group" />
- <asp:BoundField DataField="Name" HeaderText="Name" />
- <asp:BoundField DataField="Shiftname" HeaderText="Shift" />
- <asp:BoundField DataField="OffDayName" HeaderText="Offday" />
- <asp:BoundField DataField="BranchName" HeaderText="Branch" />
- <asp:BoundField DataField="Category" HeaderText="Category" />
- <asp:BoundField DataField="UserType" HeaderText="User Type" />
- </Fields>
- <PagerSettings PageButtonCount="5" />
- </asp:DetailsView>
- </td>
- </tr>
- </table>
- <br/>
- <asp:Button ID="btnClose" runat="server" Text="Back" />
- protected void btnViewMore_Click(object sender, EventArgs e)
- {
- Button btndetails = sender as Button;
- GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
- string MachID = GridView2.DataKeys[gvrow.RowIndex].Value.ToString();
- Session["MachIdgrid"] = MachID.ToString();
- GetDatBind(MachID);
- this.ModalPopupExtender1.Show();
- }
- private void GetDatBind(string EmpID)
- {
- DataTable dt = new DataTable();
- DataTable dt1 = new DataTable();
- 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 + "'";
- dt.Clear();
- dt = conn.gettable(qry);
- qry = "select ot, pf, esi, TDS, Nominee, groupname, Name, Shiftname, OffDayName, BranchName, Category, UserType from View_EmpDetailsPopup where MachID='" + EmpID + "'";
- dt1.Clear();
- dt1 = conn.gettable(qry);
- if (dt1.Rows.Count > 0)
- {
- if (dt1.Rows[0].ItemArray[1].ToString() == "1")
- {
- for (int i = 0; i < 5; i++)
- {
- if (dt1.Rows[0].ItemArray[i].ToString() == "1")
- {
- string column = dt1.Columns[i].ColumnName.ToString();
- dt1.Columns.RemoveAt(i);
- DataColumn Col = dt1.Columns.Add(column, typeof(string));
- Col.SetOrdinal(i);
- dt1.Columns[column].Expression = "'Yes'";
- }
- else
- {
- string column = dt1.Columns[i].ColumnName.ToString();
- dt1.Columns.RemoveAt(i);
- DataColumn Col = dt1.Columns.Add(column, typeof(string));
- Col.SetOrdinal(i);
- dt1.Columns[column].Expression = "'No'";
- }
- }
- GridView1.DataSource = dt;
- GridView1.DataBind();
- DetailsView2.DataSource = dt1;
- DetailsView2.DataBind();
- DetailsView1.DataSource = dt;
- DetailsView1.DataBind();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement