암호의 값을 Label
으로 캡처하려고합니다.페이지로드 중 레이블이 변경됨
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;
}
}
내 페이지로드
: 4 자리 문자 및 1의 소문자 편지이 자리하고 NUM
public void SaveTransactionID()
{
string password = lblStart.Text + lblStop.Text;
lblPassword.Text = password;
}
발전기 모두를 추가하는 나의 방법이다
protected void Page_Load(object sender, EventArgs e)
{
char lowerCase;
lowerCase = Convert.ToChar(RandomLetter.GetLetter());
lblStop.Text = lowerCase.ToString();
GenRandomNumber();
}
비밀번호가 페이지로드마다 변경된다는 것을 알고 있습니다. 그래서 내 페이지를 다시로드 할 경우 암호를 캡처 할 수 있도록 내 Label
에 저장하려고했습니다. 하지만 상황은 내 페이지로드 중에 SaveTransactonId()
도 변경됩니다. 페이지로드시에도 비밀번호의 값을 어떻게 저장할 수 있습니까?
if (IsPostBack) {} 문제가 해결됩니다 :) –
값/텍스트가 서버 측에서 변경된 후 텍스트 상자에서 텍스트/값 가져 오기] (http://stackoverflow.com/questions)를 복제 할 수 있습니다./34544500/text-value-text-value-text-value-text-changed-server-side) –
@ManishGoswami 작업을 수행했습니다 –