Darwin Ahmed

Darwin Ahmed

  • NA
  • 6
  • 934

Compiler Error Message: CS1061

Aug 27 2019 6:09 PM
In my local machine, its working perfect but when I upload in my hostname, error occured.
 
Compiler Error Message: CS1061: 'ASP.cusinfo_aspx' does not contain a definition for 'TextBoxCustomerNo_TextChanged' and no extension method 'TextBoxCustomerNo_TextChanged' accepting a first argument of type 'ASP.cusinfo_aspx' could be found (are you missing a using directive or an assembly reference?)
 
This is my code in desgn page
 
Line 58: <asp:TextBox ID="TextBoxCustomerNo" runat="server" OnTextChanged="TextBoxCustomerNo_TextChanged" AutoPostBack="True" CssClass="form-control" width="400px"></asp:TextBox>
 
this is my code behind:
  1. protected void TextBoxCustomerNo_TextChanged(object sender, EventArgs e)  
  2. {  
  3. //Search for the Customer from database  
  4. SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);  
  5. con.Open();  
  6. SqlCommand com = new SqlCommand("Select * from CustomerData Where CISno= '" + TextBoxCustomerNo.Text + "'", con);  
  7. //SqlDataAdapter da = new SqlDataAdapter(com);  
  8. SqlDataReader dr = com.ExecuteReader();  
  9. if (dr.Read())  
  10. {  
  11. TxtFName.Text = (dr["Fname"].ToString());  
  12. TxtLName.Text = (dr["Lname"].ToString());  
  13. DropDwnCategory.SelectedItem.Text = (dr["Category"].ToString());  
  14. DropDwnIDtype.SelectedItem.Text = (dr["IDtype"].ToString());  
  15. TxtIDNo.Text = (dr["IDno"].ToString());  
  16. //check if date is not null  
  17. var dbirt = DateTime.Parse(dr["Dbirth"].ToString());  
  18. if (dbirt != null)  
  19. {  
  20. TxtDbirth.Text = dbirt.ToString("yyyy-MM-dd");  
  21. }  
  22. TxtPbirth.Text = (dr["Pbirth"].ToString());  
  23. TxtAddress.Text = (dr["Addr"].ToString());  
  24. TxtCity.Text = (dr["City"].ToString());  
  25. DropDwnNationality.SelectedItem.Text = (dr["Nationality"].ToString());  
  26. TxtContact.Text = (dr["Contactno"].ToString());  
  27. DropDwnSrcIncome.SelectedItem.Text = (dr["Sourceoffund"].ToString());  
  28. DropDwnWork.SelectedItem.Text = (dr["Natureofwork"].ToString());  
  29. HyperLink1.NavigateUrl = "~/Tomerphoto.aspx?CISno=" + TextBoxCustomerNo.Text;  
  30. DropDownSex.SelectedItem.Text = dr["Gender"].ToString();  
  31. TxtEmail.Text = dr["Email"].ToString();  
  32. TxtEmployer.Text = (dr["Employer"].ToString());  
  33. TxtPostalCode.Text = dr["Postalcode"].ToString();  
  34. DropDwnCountry.SelectedItem.Text = dr["Country"].ToString();  
  35. var dex = DateTime.Parse(dr["Idexpireon"].ToString());  
  36. ExpiryDate.Text = dex.ToString("dd/MM/yyyy");  
  37. if (ExpiryDate.Text == "01/01/1900")  
  38. {  
  39. CheckIDNoExpire.Checked = true;  
  40. ExpiryDate.Visible = false;  
  41. }  
  42. else  
  43. {  
  44. ExpiryDate.Text = dex.ToString("yyyy-MM-dd");  
  45. }  
  46. txtComment.Text = dr["Comment"].ToString();  
  47. con.Close();  
  48. BtnUpdate.Visible = true;  
  49. BtnSave.Visible = false;  
  50. }  
  51. }  

Answers (3)