Click here to Skip to main content
13,191,040 members (65,441 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have an aspx program where i want to load a file inside the iFrame. And it is loading fine. But after loading when one wants to add feedback then after clicking feedback button the file Unloads automatically, and have to load again.

the code for loading model and feedback is:
protected void Feedback_Click(object sender, EventArgs e)
{
    try
    {
        WebGLApp1.Feedback.CreateFeedbackTable();
    
    }
    catch(Exception)
    {
 
    }
    string Uname = Session["username"].ToString();
    string Fname = Session["filename"].ToString();
    string Object="Object1";
    string Fback=TextBox1.Text;
    WebGLApp1.Feedback.InsertFeedBack(Uname, Fname, Object, Fback);
    TextBox1.Text = null;
    BindGridviewDataFeedback(Fname);
   
}
 
protected void lnkLoadModel_Click(object sender, EventArgs e)
{
 
    
    LinkButton lnkbtn = sender as LinkButton;
    GridViewRow gvrow = lnkbtn.NamingContainer as GridViewRow;
 
    int fileid = -1;
    for (int cnt = 0; cnt < gvDetails.Rows.Count; cnt++)
    {
        if (gvrow.RowIndex == gvDetails.Rows[cnt].RowIndex)
        {
            fileid = cnt;
            break;
        }
    }
 
    //int nFieldCount = gvDetails.Rows[fileid].Cells.Count;
    string Name = gvDetails.Rows[fileid].Cells[0].Text.Trim();
    //Name = gvDetails.Rows[fileid].Cells[1].Text;
    Session["filename"] = Name;
    using (SqlConnection con = new SqlConnection(strCon))
    {
        using (SqlCommand cmd = new SqlCommand())
        {
            cmd.CommandText = "Use iVizDatabase;select FileName, FileType, FileData from FileManager where Number=@ID ";
            cmd.Parameters.AddWithValue("@Id", fileid+1);
            cmd.Connection = con;
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();
 
            if (dr.Read())
            {
                Response.ContentType = dr["FileType"].ToString();
                Response.AddHeader("Content-Disposition", "attachment;filename=\"" + Name + "\"");
                Response.BinaryWrite((byte[])dr["FileData"]);
                Response.End();
            }
        }
    }
}
Posted 4-Jan-16 17:57pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.171016.2 | Last Updated 5 Jan 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100