I'm trying to capture the value of my password to Label
.
4 digit letter and 1 lower case letter
This is my method to add both digit and num
public void SaveTransactionID()
{
string password = lblStart.Text + lblStop.Text;
lblPassword.Text = password;
}
The generators:
private void GenRandomNumber()
{
Random generator = new Random();
String r = generator.Next(0, 10000).ToString("D4");
lblStart.Text = r;
}
//Generate Random Letter
static class RandomLetter
{
static Random _random = new Random();
public static char GetLetter()
{
// This method returns a random lowercase letter.
// ... Between 'a' and 'z' inclusize.
int num = _random.Next(0, 26); // Zero to 25
char let = (char)('a' + num);
return let;
}
}
My page load
protected void Page_Load(object sender, EventArgs e)
{
char lowerCase;
lowerCase = Convert.ToChar(RandomLetter.GetLetter());
lblStop.Text = lowerCase.ToString();
GenRandomNumber();
}
I know that my password will change every page load. That is why I tried to save it on my Label
so I could capture the password in case the page loads again. But the things is my SaveTransactonId()
also change during page load. How could I store the value of my password even with page load?