Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

upload file

$
0
0

hey

i upload file  but it save in directory  and i also wnat to show in gridview

my code is

this is upload button code

protected void Button1_Click(object sender, EventArgs e)
        {

            TextBox1.Text = "";
            if(FileUpload1.PostedFile!=null&&FileUpload1.PostedFile.ContentLength>0)
            {
                string filename=Path.GetFileName(FileUpload1.PostedFile.FileName);
                string folder=Server.MapPath("~/files/");
                Directory.CreateDirectory(folder);
                FileUpload1.PostedFile.SaveAs(Path.Combine(folder,filename));
                try
                {
                    cf.uploadfile(TextBox1.Text, FileUpload1.FileName, Convert.ToInt32(DropDownList1.SelectedValue), Convert.ToInt32(DropDownList2.SelectedValue));
                    GridView1.DataSource = cf.getfile();
                    GridView1.DataBind();
                   Label13.Text = "Success,file saved";
                    //Response.Write("Uploaded: " +filename);
                }
                    catch
                {
                        Label13.Text="Operation failed";
                    }


this is insert file store procedure

ALTER procedure [dbo].[spuplaodfile]
@DocName nvarchar(50),
@UploadedDate  nvarchar(50),
@Uploadfile nvarchar(50),
@DocTypeID int,
@DepID int
as
insert into Document (DocName,UploadedDate ,Uploadfile,DocTypeID,DepID)
values (@DocName,@UploadedDate,@Uploadfile,@DocTypeID,@DepID)

i want to show these fileds in gridview i.e doc name doctype,dep type which is i given in above store procedure

and also uplaod file

but when i run it not show me in gridview ... how i done ?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>