Guest User

Guest User

  • Tech Writer
  • 271
  • 32.9k

value cannot be null. parameter name string

Dec 15 2020 6:04 AM
hi
 
I am stuck in this error "value cannot be null. parameter name string"
  1. protected void btnupdate_Click(object sender, EventArgs e)  
  2. {  
  3. if (Page.IsValid)  
  4. {  
  5. using (var context = new schoolDbContext())  
  6. {  
  7. var UserName = txtUserName.Text;  
  8. var id = Int32.Parse(Request.QueryString["Id"]); // error in this line  
  9. var std = (from x in context.Users  
  10. where x.Id == id  
  11. select x).First();  
  12. if (std != null)  
  13. {  
  14. std.UserName = txtUserName.Text;  
  15. std.FirstName = txtFirstName.Text;  
  16. std.LastName = txtLastname.Text;  
  17. std.ClassAssigned = txtClassAssigned.Text;  
  18. std.Qualification = txtQualification.Text;  
  19. std.UserType = ddlType.SelectedValue;  
  20. std.Email = txtEmail.Text;  
  21. std.ContactNo = txtContact.Text;  
  22. context.SaveChanges();  
  23. }  
  24. }  
  25. }  
  26. }  

Answers (4)