how to get textbox value in AjaxFileUpload1_UploadComplete() event

Posted by Prabu_Spark under ASP.NET AJAX on 11/27/2012 | Points: 10 | Views : 2272 | Status : [Member] | Replies : 0
Hi sir,
I cant able to access the textbox value in AjaxFileUpload1_UploadComplete. I
attached the code below. Kindly give me the solution for this problem.



protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{

string filepath = Server.MapPath("uploaded/") + e.FileName;
AjaxFileUpload1.SaveAs(filepath);
string s;

//Getting the empty value in string s
s = txt_uhid.Text;

FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] photo = br.ReadBytes((int)fs.Length);

br.Close();
fs.Close();
// int result;

SqlConnection con = new SqlConnection( WebConfigurationManager.ConnectionStrings["con"].ToString());
SqlCommand cmd;
con.Open();
string query = "insert into photos(uhid,picture) values(@uhid,@picturename)";
cmd = new SqlCommand(query, con);

cmd.Parameters.Add("@uhid", SqlDbType.VarChar).Value = txt_uhid.Text;
cmd.Parameters.Add("@picturename", SqlDbType.Image, photo.Length).Value = photo;

cmd.ExecuteNonQuery();
con.Close();



}

With regards,
J.Prabu.
[Email:prbspark@gmail.com]



Responses

(No response found.)

Login to post response