Skip to content
Loading
How to Open the popup on same webpage--%>  
  •   
  •   
  •   
  •   
  • 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.   
    3. "http://www.w3.org/1999/xhtml">  
    4. "server">  
    5.   
    6. "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">  
    7. "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript">  
    8. "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"  
    9. rel="stylesheet" type="text/css" />  
    10. "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.   
    24.   
    25.   
    26.   
    27. "form1" runat="server">  
    28. "ShowPopup1" runat="server" Text="Name">  
    29. "dialog" style="display: none">  
    30. "GridView2" runat="server" AutoGenerateColumns="false" OnPageIndexChanging="OnPageIndexChanging"  
    31. PageSize="1" AllowPaging="true">  
    32.   
    33. "CustomerId" HeaderText="Word resume (download)" ItemStyle-Width="80" />  
    34. "Name" HeaderText="LinkedIn" ItemStyle-Width="150" />  
    35. "Country" HeaderText="Digital resume" ItemStyle-Width="150" />  
    36. "SourceId" HeaderText="Source" ItemStyle-Width="80" />  
    37. "Workauthorization" HeaderText="Work authorization" ItemStyle-Width="150" />  
    38. "HRworked" HeaderText="HR worked" ItemStyle-Width="150" />  
    39.   
    40.   
      
  •   
  •   
  •   
  • 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. }  

    1 Reply

    Know the answer? Post it — somebody with the same question will find it here.