skip to Main Content

in client side :

<script type="text/javascript">
    function ShowDetailPopup(FPS_Code, PhaseNo) {
      popup.SetContentUrl("test4.aspx?id=" + FPS_Code + "&PhaseNo=" + PhaseNo);
      popup.Show();
    }
</script>

in server side:

using (SqlConnection con = new SqlConnection(strcon1))
{
    SqlCommand cmd = new SqlCommand("SELECT ID,DocumentNo,ReleaseNo,PhaseNo,FPS_Code,DrawingNo  FROM   Project1 WHERE FPS_Code=@FPS_Code and PhaseNo=@PhaseNo");

    cmd.Parameters.AddWithValue("@FPS_Code", Request.QueryString["id"].ToString());
    cmd.Parameters.AddWithValue("@PhaseNo", Request.QueryString["PhaseNo"]);

    cmd.CommandType = CommandType.Text;
    cmd.Connection = con;
    con.Open();
    SqlDataReader sdr = cmd.ExecuteReader();
    while (sdr.Read())
    {
        ASPxLabel1.Text = sdr["ID"].ToString();
        ASPxLabel2.Text = sdr["ReleaseNo"].ToString();
        ASPxLabel3.Text = sdr["PhaseNo"].ToString();
        ASPxLabel4.Text = sdr["DrawingNo"].ToString();
        ASPxLabel5.Text = sdr["FPS_Code"].ToString();
       
    }

    con.Close();

}

enter image description here

3

Answers


  1. Just use url escaping as below:

    <script type="text/javascript">
        function ShowDetailPopup(FPS_Code, PhaseNo) {
          popup.SetContentUrl(encodeURIComponent("test4.aspx?id=" + FPS_Code + "&PhaseNo=" + PhaseNo));
          popup.Show();
        }
    </script>
    Login or Signup to reply.
  2. You can specify Float data type when adding parameter to SqlCommand as follows:

    cmd.Parameters.Add("@FPS_Code", SqlDbType.Float, 20).Value = Request.QueryString["id"];
    
    Login or Signup to reply.
  3. You must convert the PhaseNo string to double. Replace the line

    cmd.Parameters.AddWithValue("@PhaseNo", Request.QueryString["PhaseNo"]);
    

    with

    cmd.Parameters.AddWithValue("@PhaseNo", System.Convert.ToDouble(Request.QueryString["PhaseNo"]));
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search