Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys,

C#
protected String UploadFolderPath = "~/Images/";

        protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
        {
            String filename = System.IO.Path.GetFileName(AsyncFileUpload1.FileName);
            AsyncFileUpload1.SaveAs(Server.MapPath(this.UploadFolderPath) + filename);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            String productName = this.TextBox1.Text;
            string productDesc = this.TextBox2.Text;


            String pCategoryIDs = this.TextBox3.Text;
            int pCategoryID = Convert.ToInt32(pCategoryIDs);
            String prodPrice = this.TextBox4.Text;
            double productPrice = Convert.ToDouble(prodPrice);
            String stockQty = this.TextBox5.Text;
            int stockQuantity = Convert.ToInt32(stockQty);

            BQ_BLL insertprod = new BQ_BLL();
            insertprod.InsertProduct(productName, productDesc, filename, pCategoryID, productPrice, stockQuantity);

        }


I wanted to ask how can I store filename(from the AsyncFileUpload1_UploadedComplete method) to my InsertProduct(productName, productDesc, filename(this one), pCategoryID, productPrice, stockQuantity);
Posted
Updated 30-Jun-13 6:32am
v2
Comments
[no name] 30-Jun-13 12:11pm    
You mean exactly like you are already doing in your button click? You need to create a common method and pass the data to that method from both of your event handlers.
Shahin Khorshidnia 30-Jun-13 13:33pm    
Why in comments section?
NooobieCoder 30-Jun-13 13:24pm    
yes

Use proprties get and set functions
 
Share this answer
 
thanks people, problem is solved:)
 
Share this answer
 

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