Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:
C#
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
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900