Mas

Mas

  • NA
  • 478
  • 71.2k

How to Open the popup on same webpage

Mar 24 2020 11:15 PM
Hello Members,
 
Hope you are doing good!!
 
Here I am trying to open the POPUP on same webpage, But it is opening in Webform1 page..
 
Here a, attaching the file.
 
Can anyone guide me here.
 
Thank you in advance!!
 
Default.ASPX page.
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Findcandidates._default" %>  
  2. <!DOCTYPE html>  
  3. <html xmlns="http://www.w3.org/1999/xhtml">  
  4. <head runat="server">  
  5. <meta charset="utf-8" />  
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />  
  7. <title>Candidate details</title>  
  8. <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />  
  9. <link rel="stylesheet" href="/resources/demos/style.css" />  
  10. <script src="https://code.jquery.com/jquery-1.12.4.js"></script>  
  11. <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>  
  12. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>  
  13. <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>  
  14. <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"  
  15. rel="stylesheet" type="text/css" />  
  16. <script type="text/javascript">  
  17. $(function () {  
  18. $("[id*=ShowPopup1]").click(function () {  
  19. Name();  
  20. return false;  
  21. });  
  22. });  
  23. function Name() {  
  24. $("#dialog").dialog({  
  25. width: 400,  
  26. modal: true  
  27. });  
  28. }  
  29. $(function () {  
  30. $( "#tabs" ).tabs();  
  31. });  
  32. $(document).ready(function() {  
  33. var $submit = $("#submit_prog").hide(),  
  34. $cbs = $('input[name="prog"]').click(function() {  
  35. $submit.toggle( $cbs.is(":checked") );  
  36. });  
  37. });  
  38. </script>  
  39. <style>  
  40. #GridView1,#GridView2 {  
  41. font-family: Segoe UI;  
  42. font-size: 10px;  
  43. }  
  44. #GridView1,#GridView2 {  
  45. font-family: 'Segoe UI';  
  46. border-collapse: collapse;  
  47. width: 80%;  
  48. font-size: 10px;  
  49. }  
  50. #GridView1 td, #GridView1 th, #GridView2 td, #GridView2 th {  
  51. border: 1px solid #ddd;  
  52. padding: 8px;  
  53. }  
  54. GridView1 tr:nth-child(even),GridView2 tr:nth-child(even) {  
  55. background-color: #f2f2f2;  
  56. }  
  57. #GridView1 th,#GridView2 th {  
  58. padding-top: 4px;  
  59. padding-bottom: 4px;  
  60. text-align: center;  
  61. background-color: cornflowerblue;  
  62. color: white;  
  63. }  
  64. </style>  
  65. </head>  
  66. <body>  
  67. <form runat="server">  
  68. <input type="submit" id="submit_prog" value='Send email' style="font-family: 'Segoe UI'; font-size: 10px; text-align: center;" />  
  69. <div id="tabs">  
  70. <ul>  
  71. <li><a href="#tabs-1" style="font-family: 'Segoe UI'; font-size: 10px; text-align: center; width: 80px;">Sophus IT solutions</a></li>  
  72. <li><a href="#tabs-2" style="font-family: 'Segoe UI'; font-size: 10px; text-align: center; width: 80px;">Ceipal</a></li>  
  73. <%--<li><a href="#tabs-3" style="font-family: 'Segoe UI'; font-size: 10px; text-align: center; width: 80px;">Monster</a></li>--%>  
  74. </ul>  
  75. <div id="tabs-1">  
  76. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" OnRowDataBound="OnRowDataBound">  
  77. <Columns>  
  78. <asp:TemplateField>  
  79. <ItemTemplate>  
  80. <asp:CheckBox ID="checkbox" runat="server" />  
  81. </ItemTemplate>  
  82. </asp:TemplateField>  
  83. <asp:BoundField DataField="resumetoJDmatch" HeaderText="Resume to JD match" ItemStyle-Width="140" />  
  84. <asp:BoundField DataField="mandatoryskillmatch" HeaderText="mandatory skill match" ItemStyle-Width="100" />  
  85. <asp:BoundField DataField="Datecreated" HeaderText="Date created" ItemStyle-Width="90" />  
  86. <asp:HyperLinkField DataTextField="Name" HeaderText="Name" ItemStyle-Width = "150" DataNavigateUrlFields="mandatoryskillmatch" DataNavigateUrlFormatString="~/WebForm1.aspx?Id={0}"/>  
  87. <asp:BoundField DataField="phonenumber" HeaderText="Phone number" ItemStyle-Width="100" />  
  88. <asp:BoundField DataField="email" HeaderText="E-mail" ItemStyle-Width="90" />  
  89. <asp:BoundField DataField="location" HeaderText="Location" ItemStyle-Width="120" />  
  90. </Columns>  
  91. </asp:GridView>  
  92. <div id="dialog" style="display: none">  
  93. <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" OnPageIndexChanging="OnPageIndexChanging"  
  94. PageSize="1" AllowPaging="true">  
  95. <Columns>  
  96. <asp:BoundField DataField="CustomerId" HeaderText="Word resume (download)" ItemStyle-Width="80" />  
  97. <asp:BoundField DataField="Name" HeaderText="LinkedIn" ItemStyle-Width="150" />  
  98. <asp:BoundField DataField="Country" HeaderText="Digital resume" ItemStyle-Width="150" />  
  99. <asp:BoundField DataField="SourceId" HeaderText="Source" ItemStyle-Width="80" />  
  100. <asp:BoundField DataField="Workauthorization" HeaderText="Work authorization" ItemStyle-Width="150" />  
  101. <asp:BoundField DataField="HRworked" HeaderText="HR worked" ItemStyle-Width="150" />  
  102. </Columns>  
  103. </asp:GridView>  
  104. </div>  
  105. <%-- <input type="checkbox" name="prog" value="1" />--%>  
  106. </div>  
  107. <div id="tabs-2">  
  108. </div>  
  109. <%-- <div id="tabs-3">  
  110. </div>--%>  
  111. </div>  
  112. </form>  
  113. </body>  
  114. </html>  
Default.cs Page
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Web;  
  5. using System.Web.UI;  
  6. using System.Web.UI.WebControls;  
  7. using System.Data;  
  8. using MySql.Data.MySqlClient;  
  9. using System.Configuration;  
  10. namespace Findcandidates  
  11. {  
  12. public partial class _default : System.Web.UI.Page  
  13. {  
  14. protected void Page_Load(object sender, EventArgs e)  
  15. {  
  16. if (!this.IsPostBack)  
  17. {  
  18. DataTable dt = new DataTable();  
  19. dt.Columns.AddRange(new DataColumn[7] { new DataColumn("resumetoJDmatch"), new DataColumn("mandatoryskillmatch"), new DataColumn("Datecreated"), new DataColumn("Name"), new DataColumn("phonenumber"), new DataColumn("email"), new DataColumn("Location") });  
  20. dt.Rows.Add( "100%","90%""13-may-2019","Suresh Kumar","1234567890","[email protected]""san Jose,CA");  
  21. dt.Rows.Add("100%""90%""13-may-2019""Suresh Kumar""1234567890""[email protected]""san Jose,CA");  
  22. GridView1.DataSource = dt;  
  23. GridView1.DataBind();  
  24. }  
  25. if (!this.IsPostBack)  
  26. {  
  27. this.BindGrid();  
  28. }  
  29. }  
  30. private void BindGrid()  
  31. {  
  32. string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;  
  33. using (MySqlConnection con = new MySqlConnection(constr))  
  34. {  
  35. using (MySqlCommand cmd = new MySqlCommand("SELECT CustomerId, Name, Country,SourceId,Workauthorization,HRworked FROM Customers"))  
  36. {  
  37. using (MySqlDataAdapter sda = new MySqlDataAdapter())  
  38. {  
  39. cmd.Connection = con;  
  40. sda.SelectCommand = cmd;  
  41. using (DataTable dt = new DataTable())  
  42. {  
  43. sda.Fill(dt);  
  44. GridView2.DataSource = dt;  
  45. GridView2.DataBind();  
  46. }  
  47. }  
  48. }  
  49. }  
  50. }  
  51. protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)  
  52. {  
  53. GridView2.PageIndex = e.NewPageIndex;  
  54. this.BindGrid();  
  55. ClientScript.RegisterStartupScript(this.GetType(), "Popup""ShowPopup();"true);  
  56. }  
  57. protected void OnRowDataBound(object sender, GridViewRowEventArgs e)  
  58. {  
  59. DataTable dt = new DataTable();  
  60. dt.Columns.AddRange(new DataColumn[7] { new DataColumn("resumetoJDmatch"), new DataColumn("mandatoryskillmatch"), new DataColumn("Datecreated"), new DataColumn("Name"), new DataColumn("phonenumber"), new DataColumn("email"), new DataColumn("Location") });  
  61. foreach (GridViewRow row in GridView1.Rows)  
  62. {  
  63. if (row.RowType == DataControlRowType.DataRow)  
  64. {  
  65. CheckBox checkbox = (row.Cells[0].FindControl("checkbox"as CheckBox);  
  66. if (checkbox.Checked)  
  67. {  
  68. string resumetoJDmatch = row.Cells[1].Text;  
  69. string mandatoryskillmatch = row.Cells[2].Text;  
  70. string Datecreated = row.Cells[3].Text;  
  71. string Name = row.Cells[4].Text;  
  72. string phonenumber = row.Cells[5].Text;  
  73. string email = row.Cells[6].Text;  
  74. string Location = row.Cells[7].Text;  
  75. dt.Rows.Add(resumetoJDmatch, mandatoryskillmatch, Datecreated, Name, phonenumber, email, Location);  
  76. }  
  77. }  
  78. }  
  79. }  
  80. }  
  81. }  
Webform1.aspx
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Findcandidates.WebForm1" %>  
  2. <!DOCTYPE html>  
  3. <html xmlns="http://www.w3.org/1999/xhtml">  
  4. <head runat="server">  
  5. <title></title>  
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>  
  7. <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>  
  8. <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"  
  9. rel="stylesheet" type="text/css" />  
  10. <script type="text/javascript">  
  11. $(function () {  
  12. $("[id*=ShowPopup1]").click(function () {  
  13. Name();  
  14. return false;  
  15. });  
  16. });  
  17. function Name() {  
  18. $("#dialog").dialog({  
  19. width: 400,  
  20. modal: true  
  21. });  
  22. }  
  23. </script>  
  24. <style>  
  25. #GridView2 {  
  26. font-family: Segoe UI;  
  27. font-size: 10px;  
  28. }  
  29. #GridView2 {  
  30. font-family: 'Segoe UI';  
  31. border-collapse: collapse;  
  32. width: 80%;  
  33. font-size: 10px;  
  34. }  
  35. #GridView2 td, #GridView2 th {  
  36. border: 1px solid #ddd;  
  37. padding: 8px;  
  38. }  
  39. GridView2 tr:nth-child(even) {  
  40. background-color: #f2f2f2;  
  41. }  
  42. #GridView2 th {  
  43. padding-top: 4px;  
  44. padding-bottom: 4px;  
  45. text-align: center;  
  46. background-color: cornflowerblue;  
  47. color: white;  
  48. }  
  49. </style>  
  50. </head>  
  51. <body>  
  52. <form id="form1" runat="server">  
  53. <asp:HyperLink ID="ShowPopup1" runat="server" Text="Name"></asp:HyperLink>  
  54. <div id="dialog" style="display: none">  
  55. <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" OnPageIndexChanging="OnPageIndexChanging"  
  56. PageSize="1" AllowPaging="true">  
  57. <Columns>  
  58. <asp:BoundField DataField="CustomerId" HeaderText="Word resume (download)" ItemStyle-Width="80" />  
  59. <asp:BoundField DataField="Name" HeaderText="LinkedIn" ItemStyle-Width="150" />  
  60. <asp:BoundField DataField="Country" HeaderText="Digital resume" ItemStyle-Width="150" />  
  61. <asp:BoundField DataField="SourceId" HeaderText="Source" ItemStyle-Width="80" />  
  62. <asp:BoundField DataField="Workauthorization" HeaderText="Work authorization" ItemStyle-Width="150" />  
  63. <asp:BoundField DataField="HRworked" HeaderText="HR worked" ItemStyle-Width="150" />  
  64. </Columns>  
  65. </asp:GridView>  
  66. </div>  
  67. </form>  
  68. </body>  
  69. </html>  
Webform1.cs
  1. using MySql.Data.MySqlClient;  
  2. using System;  
  3. using System.Configuration;  
  4. using System.Data;  
  5. using System.Web.UI.WebControls;  
  6. namespace Findcandidates  
  7. {  
  8. public partial class WebForm1 : System.Web.UI.Page  
  9. {  
  10. protected void Page_Load(object sender, EventArgs e)  
  11. {  
  12. if (!this.IsPostBack)  
  13. {  
  14. this.BindGrid();  
  15. }  
  16. }  
  17. private void BindGrid()  
  18. {  
  19. string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;  
  20. using (MySqlConnection con = new MySqlConnection(constr))  
  21. {  
  22. using (MySqlCommand cmd = new MySqlCommand("SELECT CustomerId, Name, Country,SourceId,Workauthorization,HRworked FROM Customers"))  
  23. {  
  24. using (MySqlDataAdapter sda = new MySqlDataAdapter())  
  25. {  
  26. cmd.Connection = con;  
  27. sda.SelectCommand = cmd;  
  28. using (DataTable dt = new DataTable())  
  29. {  
  30. sda.Fill(dt);  
  31. GridView2.DataSource = dt;  
  32. GridView2.DataBind();  
  33. }  
  34. }  
  35. }  
  36. }  
  37. }  
  38. protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)  
  39. {  
  40. GridView2.PageIndex = e.NewPageIndex;  
  41. this.BindGrid();  
  42. ClientScript.RegisterStartupScript(this.GetType(), "Popup""ShowPopup();"true);  
  43. }  
  44. }  
  45. }  

Answers (1)