Please note:- I already have gone few links answered but they are leading to controls only. I can use objects easily to access into objects, no issues about that. Issue is with variables accessing at runtime. One is directing to variable, but I found it very tough and rigid one. So want to know any simple and easy way.
I have a requirement following:-
Scenario for e.g.:-
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.
For e.g. to more going in practical:-
// 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();
Since I have lot of objects and variables and later to work on variables, I want this to do in a loop like logic at a time instead of assigning them at individual basis.
Is there any such possible in Asp.net C#?