title: Linking an aspx.cs file and master page
body: <p>I have been struggling for quite a while with this assignment. I need to use a master page and link it to two ASPX pages. Any help or suggestions would be so helpful. My problem is i am running two programs through this master page and I cannot get them to work properly. When I click the submit button, it will not post any results, which they both did without a master page. Thanks!</p>
  
  <p>Here's my Master page code:</p>
  
  <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;asp:ContentPlaceHolder id="HeadContent" runat="server"&gt;
      &lt;/asp:ContentPlaceHolder&gt;
      &lt;link href="Math.css" rel="Stylesheet" type="text/css" /&gt; 
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div id="divWrapper"&gt;
          &lt;div id="mainContent" &gt; &lt;!-- This div will contain the main content of the page, unique --&gt;
          &lt;asp:ContentPlaceHolder id="contentMain" runat="server"&gt;
  
          &lt;/asp:ContentPlaceHolder&gt;
          &lt;/div&gt;
          &lt;div id="divLeftContent" &gt; &lt;!-- Contains left content, buttons --&gt;
              &lt;div id="LnkMenuIndividualButtons"&gt;
  
                  &lt;!-- #include file="leftcontent.htm" --&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Heres triangles.aspx</p>
  
  <pre><code>&lt;%@ Page Title="Home Page" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
      CodeFile="Triangles.aspx.cs" Inherits="_Default" %&gt;
  
  &lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt;
   &lt;% trianglePossible();
      primeNumbers(); %&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="contentMain"&gt;
  
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Here's Triangles.aspx.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  
  public partial class _Default : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      public void trianglePossible()
      {
          try
          {
              decimal length1 = decimal.Parse(Request.Form["Text1"]);
              decimal length2 = decimal.Parse(Request.Form["Text2"]);
              decimal length3 = decimal.Parse(Request.Form["Text3"]);
              if ((length1 + length2 &gt; length3) &amp;&amp; (length2 + length3 &gt; length1) &amp;&amp; (length1 + length3 &gt; length2))
              {
                  Response.Write(" This triangle is possible. ");
              }
              else
              {
                  Response.Write(" This triangle is not possible. ");
              }
          }
          catch
          {
              Response.Write(" Go back and fix error, must contain all numerics only. ");
          }
  
  
      }
  
     public void primeNumbers()
         {
          int primeNumber1 = int.Parse(Request.Form["Text4"]);
  
          bool prime = true;
          for (int i = 2; i &lt; primeNumber1 - 1; i++)
          {
  
  
              if (primeNumber1 % i == 0)
              {
                  prime = false;
              }
  
          }
          if (prime == true)
          {
              Response.Write(" This is a prime number! ");
  
          }
          else
          {
              Response.Write(" This is not a prime number! ");
          }
          if (primeNumber1 &gt; 999 || primeNumber1 &lt; 0)
          {
              Response.Write(" Please return and enter a number between the values of 0 and 999. ");
          }
      }
  
  }
  </code></pre>
  
  <p>Here's TriangleLength.aspx</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true"  MasterPageFile="~/MasterPage.master" CodeFile="TriangleLength.aspx.cs" Inherits="_Default" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="contentMain" Runat="Server"&gt;
  
      &lt;form action="Triangles.aspx" method="post"&gt;
      &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Triangle Lengths&lt;/p&gt;
      &lt;p&gt;&lt;input name="Text1" id="Text1" type="text" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input name="Text2" id="Text2" type="text" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input name="Text3" id="Text3" type="text" /&gt;&lt;/p&gt;
      &lt;input type="submit" value="Submit" /&gt;
      &lt;/form&gt;   
  
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Finally, here's Prime NUmbers.aspx</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master" CodeFile="Triangles.aspx.cs" Inherits="_Default" %&gt;
  
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="contentMain" Runat="Server"&gt;
  
  &lt;form action="Triangles.aspx" method="post"&gt;
    &lt;p&gt;Prime Numbers&lt;/p&gt;
      &lt;p&gt;&lt;input name="Text4" id="Text4" type="text" /&gt;&lt;/p&gt;
      &lt;input type="submit" value="Submit" /&gt;
       &lt;/form&gt;
  
  &lt;/asp:Content&gt;
  </code></pre>