I am just a noob in C#, and I've got this question to ask you.
I have here a form that asks for login details. It has two textfields:
What I want is to get the strings entered in that textfields.
I am not yet familiar with the methods in C#..(in java, getString method is used). What could be the "equivalent" method here in C#?
if in string:
string yourVar = yourTextBoxname.Text;
if in numbers:
int yourVar = int.Parse(yourTextBoxname.Text);
I show you this with an example:
string userName= textBox1.text;
and then use it as you wish
to get value of textbox
string username = TextBox1.Text;
string password = TextBox2.Text;
to set value of textbox
TextBox1.Text = "my_username";
TextBox2.Text = "12345";
When using MVC, try using ViewBag. The best way to take input from textbox and displaying in View.
Source: Stackoverflow.com