The form[fieldname] method returns a string, which does not have a .Value() method. You use Int32.Parse() and DateTime.Parse().
Radio button and date's problem my ASP.NET
Harun Ergün
260
Reputation points
Friends, first of all hello.
I'm designing a simple form site. But I'm getting an error. Texts are writing to the database, but the radio button and date does not write the error explodes. I left the whole code for you to review. I need help
Developer technologies ASP.NET ASP.NET Core
4,815 questions
Developer technologies ASP.NET Other
3,597 questions
SQL Server Other
14,494 questions
2 answers
Sort by: Most helpful
-
Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
2023-05-11T15:18:27.3766667+00:00 -
AgaveJoe 30,126 Reputation points
2023-05-11T15:22:40.4533333+00:00 I recommend that you learn MVC model binding which handles type validation and converting the post parameters into a type.
If we go with your current approach, then you need to validate, which is not included, and convert the inputs yourself.
DateTime dt = DateTime.ParseExact(Request.Form["LisansBasLangicTarihi"], "dd/MM/yyyy", CultureInfo.InvariantCulture); int num = int.Parse(Request.Form["Gender"]);