Link to home
Start Free TrialLog in
Avatar of jianxin9
jianxin9

asked on

Combining two page load statements?

Is there a way to combine these two page statements into one?  Thanks!
private void Page_Load(object sender, EventArgs e)
    {
        statusCheckName.Attributes.Add("onclick", "showHide();");
        Page.ClientScript.RegisterStartupScript(this.GetType(), "OnLoadHandler", "showHide();", true);
    }
 
  void Page_Load()
  {
      if (Page.IsPostBack)
      {
          questionsPanel.Visible = false;
          Message.Visible = true;  
          int correct = 0;
          if (q1.SelectedIndex == 2) correct++;
          if (q2.SelectedIndex == 4) correct++;
          if (q3.SelectedIndex == 2) correct++;
          if (q4.SelectedIndex == 0) correct++;
          if (q5.SelectedIndex == 5) correct++;
          if (q6.SelectedIndex == 1) correct++;
          if (q7.SelectedIndex == 2) correct++;
 
          LoadConn(correct);
      }
      else
      {
          questionsPanel.Visible = true;
          Message.Visible = false;  
      }
  }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Refael Ackermann
Refael Ackermann
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jianxin9
jianxin9

ASKER

SWEET! Thank you!!!!!!
THANK YOU!