Обратите внимание: - Я уже просмотрел несколько ссылок, но они ведут только к элементам управления. Я могу легко использовать объекты для доступа к объектам, никаких проблем по этому поводу. Проблема связана с доступом к переменным во время выполнения. Один из них направлен на переменную, но я нашел ее очень жесткой и жесткой Поэтому хочу узнать любой простой и легкий способ.
У меня есть следующее требование: -
Сценарий, например, для: - *
1. TextBox_mobile is a control object in aspx page
2. mobile is a variable stored in c# .cs file
3. I have a 135+ such controls in aspx page and want to store them in variables in .cs file on say submit button.
4. I have stored in a table having two fields control_objects and against it variable names
5. So when submitt is fired (click event) I want to run the assigning task with running a process to retriew control names and
variables names and assinging the values of control objects to appropriate variables.
Например, для более практического : -
// create a variable to store textbox control
string mobile = ""
// Text_mobile is a TextBox in aspx page
// A temporary variable to store variable in loop from table
string var_mobile = "mobile"; // Currently I am hard coding
// now I wish to use this var_mobile to make automatically assign the value into main variable
<<var_mobile>> = TextBox_mobile.Text.Trim();
//and backend it should be actually storing same in earlier mobile variabl
mobile = TextBox_mobile.Text.Trim();
Так как у меня много объектов и переменных, а позже я буду работать с переменными, я хочу, чтобы это делалось в al oop как logi c за раз вместо назначения их отдельным Базис.
Есть ли такое возможно в Asp. net C#?