Friday, 15 June 2012

c# - asp.net submit process -


I have 2 labels and a text box to start random numbers, to see if answer is random add After the number is correct. The problem I am facing represents the next set of random numbers and therefore the result is always wrong. Here's the code that I've done so far.

  name space _2nd grademate {public partial square default: system Web. UI Page {Random Random = New Random (); Protected Zero Page_Load (Object Sender, EventArgs e) {lblNum1.Text = random.Next (0, 10) .toString (); LblNum3.Text = random.Next (0, 10) .toString (); Int num1 = int.Parse (lblNum1.Text); Int num2 = int.Parse (lblNum3.Text); LblAnswer.Text = (num1 + num2) .ostring (); LblAnswer.Visible = false; } Secure Zero Button 1_Click (Object Sender, EventArgs E) {If (Textbox1.Text! = LBL Encore.text) {button. a quality. Add ("onclick", "javascript: alert ('wrong');"); } And if (text box text 1 == lbl Answers.Text) {button. a quality. Add ("OnClick", "Javascript: Alert ('Correct');"); } TextBox1.Text = ""; }}}    

To run the initial code only Use when the page is initially loaded:

  protected zero page_load (object sender, eventarges e) {if (IsPostBack) {lblNum1.Text = random.Next (0, 10) .ostrong (); LblNum3.Text = random.Next (0, 10) .toString (); Int num1 = int.Parse (lblNum1.Text); Int num2 = int.Parse (lblNum3.Text); LblAnswer.Text = (num1 + num2) .ostring (); LblAnswer.Visible = false; }}    

No comments:

Post a Comment