Ejemplo n.º 1
0
        protected void btnSearchFile_Click(object sender, EventArgs e)
        {
            SearchFile ws = new SearchFile();

            GridView1.DataSource = ws.SearchByName(txtSearch.Text);
            GridView1.DataBind();
        }
Ejemplo n.º 2
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Download")
            {
                int        index        = Convert.ToInt32(e.CommandArgument);
                string     TextToSearch = txtSearch.Text.Trim();
                SearchFile ws           = new SearchFile();
                DataSet    FetchedDS    = ws.SearchByName(txtSearch.Text);
                byte[]     File_Byte    = (byte[])FetchedDS.Tables[0].Rows[index][3];
                string     File_Name    = FetchedDS.Tables[0].Rows[index][0].ToString();

                Context.Session["FileName"]  = File_Name;
                Context.Session["FileBytes"] = File_Byte;
                Response.Redirect("Download.aspx");
            }
        }