c# - How can read the value of text box from Ajaxfileupolad control -


This question is already an answer here

  • 2 responses

Assigning AjaxFileUpload1. The problem is that the variable from the text box on the page during the pageupload event, I do not find the value from the text box to my variable even if there is an error throws. My variables are

 Is  string scn = txtSCN.Text; String line1 = txtLineitem.Text; String aging 1 = txtAging.Text;  

Any idea why the AjaxFileUpload1_UploadComplete text box is not able to read the value

My CS code is:

  Protected Zero AjaxFileUpload1_UploadComplete (Object Sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) {string c = System.IO.Path.GetFileName (e.FileName); String digip = "~ / profile / images"; string scn = txtSCN.Text; string line 1 = txtLineitem.Text; string aging 1 = txtAging.Text; AjaxFileUpload1.SaveAs (MapPath (Path.Combine (dpath, c) ); Dpath = dpath + c; String str1 = Configuration Manager. Connection strings ["ProtrackConjiMCH"]. SqlConnection cn = New SqlConnection (str1); cn.Open (); String sql = "Update tbNoquoteFollowupupdate Set MailreceivedURL = '+ Dpath + '', chkMailreceived = 1, BUYERNAME = '' + BUYERNAME + '' where SCN = '' + SCN + '' and line item = '' + line 1 + '' and aging = '+ + + aging 1 + '' ''; SQL Comand CMD = New SQL Commands (SKL, CN); Int i = cmd.ExecuteNonQuery (); if (i & gt; 0) {// AjaxFile: 1.SaveAs (Path.Combine (Dipath, E. Filename)); //AjaxFileUpload1.SaveAs(MapPath(dpath));} Cn.Close (); BindGridviewData1 (); cn.Open (); String CMD2 = "insert in tbMulitmailsreived (SCN, line item, followupdate, aging, MailreceivedURL) value ('+ + SCN +', '' + Line 1 + '', '' + DateTime.Now + '', '' + +1 +1 '', '+ + + Dpath + "')"; SqlCommand sqlCommand2 = New SQL Commands (CMD2, CN); SqlCommand2.ExecuteNonQuery (); Cn.Close (); }  

Please enter a value from the text box in the session and you can access the session since The variable from the UpLoadCapplete will work everything like this.


Comments