Hi, I am trying to save a value from a drop-down list to an integer, but I get an exception. The input string was not in the correct format.
int experienceYears = Convert.ToInt32("DropDownList1.SelectedValue");
Please, help.
Remove quotation marks; the code in its current form is trying to convert a literal string "DropDownList1.SelectedValue"to an integer, which cannot be.
"DropDownList1.SelectedValue"
int experienceYears = Convert.ToInt32(DropDownList1.SelectedValue);
Try it without quotes:
Source: https://habr.com/ru/post/1749971/More articles:C ++ virtual destructors - c ++Get the process id of a program launched using C # Process.Start - puttyhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1749968/binding-update-adds-news-series-to-wpf-toolkit-chart-instead-of-replacingupdating-series&usg=ALkJrhgvMh2TEJh3HXYL6xNLMslJvDoWXQSetting setUp in PHPUnit - phpThe default namespace when creating an XML document is c #which is more efficient? checking == or just changing a variable? - performanceWhere should I handle exceptions in BLL, DAL or PL? - c #Getting the button pressed after clicking () is called in Qt (C ++) - c ++M2Eclipse deploys WEB-INF to WEB-INF / classes - javaMake DialogBox wait for user action and return a boolean value in GWT - gwtAll Articles