title: asp.net grid view hyper link pass values to new window
body: <p>hai guys here is my question please help me</p>
  
  <p>I have a gridview with hyperlink fields here my requirement is if I click on hyperlink of particular row I need to display that particular row values into other page in that page user will edit record values after that if he clicks on update button I need to update that record values and get back to previous home page. if iam clicking hyper link in first window new window should open with out any url tool bar and minimize close buttons like popup modular Ajax ModalPopUpExtender but iam un able to ge that that one please help me</p>
  
  <p>the fillowing code is defalut.aspx</p>
  
  <pre><code>&lt;head runat="server"&gt;
  &lt;title&gt;PassGridviewRow values &lt;/title&gt;
  &lt;style type="text/css"&gt;
  #gvrecords tr.rowHover:hover
  {
      background-color:Yellow;
      font-family:Arial;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;div&gt;
  &lt;asp:GridView runat="server" ID="gvrecords"  AutoGenerateColumns="false" 
  HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="White" DataKeyNames="UserId" RowStyle-CssClass="rowHover"&gt; 
  &lt;Columns&gt;
  &lt;asp:TemplateField  HeaderText="Change Password" &gt;
  &lt;ItemTemplate&gt;
  &lt;a href ='&lt;%#"UpdateGridviewvalues.aspx?UserId="+DataBinder.Eval(Container.DataItem,"UserId") %&gt;'&gt; &lt;%#Eval("UserName") %&gt;  &lt;/a&gt;
  &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  &lt;asp:BoundField DataField="FirstName" HeaderText="FirstName" /&gt;
  &lt;asp:BoundField DataField="LastName" HeaderText="LastName" /&gt;
  &lt;asp:BoundField DataField="Email" HeaderText="Email" /&gt;
  &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>following code default.aspx.cs code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Data.SqlClient;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class _Default : System.Web.UI.Page 
  {
  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  BindGridview();
  }
  }
  protected void BindGridview()
  {
  SqlConnection con = new SqlConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=testdb1");
  con.Open();
  SqlCommand cmd = new SqlCommand("select * from UserDetails", con);
  SqlDataAdapter da = new SqlDataAdapter(cmd);
  cmd.ExecuteNonQuery();
  con.Close();        
  DataSet ds = new DataSet();
  da.Fill(ds);
  gvrecords.DataSource = ds;
  gvrecords.DataBind();
  }
  }
  </code></pre>
  
  <p>this is updategridviewvalues.aspx</p>
  
  <pre><code>&lt;head runat="server"&gt;
  &lt;title&gt;Update Gridview Row Values&lt;/title&gt;
  &lt;script type="text/javascript"&gt;
  function Showalert(username) {
  alert(username + ' details updated successfully.');
  if (alert) {
  window.location = 'Default.aspx';
  }
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;div&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;td colspan="2" align="center"&gt;
  &lt;b&gt; Edit User Details&lt;/b&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  User Name:
  &lt;/td&gt;
  &lt;td&gt;
  &lt;asp:Label ID="lblUsername" runat="server"/&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  First Name:
  &lt;/td&gt;
  &lt;td&gt;
  &lt;asp:TextBox ID="txtfname" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  Last Name:
  &lt;/td&gt;
  &lt;td&gt;
  &lt;asp:TextBox ID="txtlname" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  Email:
  &lt;/td&gt;
  &lt;td&gt;
  &lt;asp:TextBox ID="txtemail" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;
  &lt;/td&gt;
  &lt;td&gt;
  &lt;asp:Button ID="btnUpdate" runat="server" Text="Update" onclick="btnUpdate_Click" /&gt;
  &lt;asp:Button ID="btnCancel" runat="server" Text="Cancel" onclick="btnCancel_Click"/&gt;
  &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and my updategridviewvalues.aspx.cs code is follows</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;
  using System.Data.SqlClient;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class UpdateGridviewvalues : System.Web.UI.Page
  {
  SqlConnection con = new SqlConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=testdb1");
  private int userid=0;
  protected void Page_Load(object sender, EventArgs e)
  {
  userid = Convert.ToInt32(Request.QueryString["UserId"].ToString());
  if(!IsPostBack)
  {
  BindControlvalues();    
  }
  
  }
  
  private void BindControlvalues()
  {
  con.Open();
  SqlCommand cmd = new SqlCommand("select * from UserDetails where UserId=" + userid, con);
  SqlDataAdapter da = new SqlDataAdapter(cmd);
  cmd.ExecuteNonQuery();
  con.Close();
  DataSet ds = new DataSet();
  da.Fill(ds);
  lblUsername.Text = ds.Tables[0].Rows[0][1].ToString();
  txtfname.Text = ds.Tables[0].Rows[0][2].ToString();
  txtlname.Text = ds.Tables[0].Rows[0][3].ToString();
  txtemail.Text = ds.Tables[0].Rows[0][4].ToString();
  }
  
  protected void btnUpdate_Click(object sender, EventArgs e)
  {
  con.Open();
  SqlCommand cmd = new SqlCommand("update UserDetails set FirstName='" + txtfname.Text + "',LastName='" + txtlname.Text + "',Email='" + txtemail.Text + "' where UserId=" + userid, con);
  SqlDataAdapter da = new SqlDataAdapter(cmd);
  int result= cmd.ExecuteNonQuery();
  con.Close();
  if(result==1)
  {
  ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:Showalert('"+lblUsername.Text+"')", true);
  }
  }
  
  protected void btnCancel_Click(object sender, EventArgs e)
  {
  Response.Redirect("~/Default.aspx");
  }
  }
  </code></pre>
  
  <p>My requirement is new window should come like pop window as new window with out having url and close button
  my database tables is</p>
  
  <pre><code>ColumnName                 DataType
  -------------------------------------------
  UserId                    Int(set identity property=true)
  UserName                 varchar(50)                 
  FirstName                varchar(50)
  LastName                 varchar(50)
  Email                    Varchar(50)
  </code></pre>