title: Change the Access Modifiers of ASP.NET controls
body: <p>If I put a control in a .aspx file like this;</p>
  
  <pre><code>&lt;asp:TextBox ID="protectedTextBox" runat="server"&gt;Some info&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>I get a declared control in the page's .aspx.designer.cs file;</p>
  
  <pre><code>protected global::System.Web.UI.WebControls.TextBox protectedTextBox;
  </code></pre>
  
  <p>But I'd like to change the access modifier of the control to <code>public</code>. Is there any attribute or similar that I can set to change the access modifier? </p>
  
  <p>Here's <em>why</em> I want to do it. I am trying to have cross-page postbacks work nice and neatly. I have two pages:</p>
  
  <pre><code>FirstPage.aspx
      MyTextBox : textbox
      MyButton  : button, @PostbackUrl=Secondpage
  
  SecondPage.aspx
      MyLabel : label
  </code></pre>
  
  <p>When the user clicks FirstPage.MyButton, I want to write the value of <code>FirstPage.MyTextBox.Text</code> into <code>SecondPage.MyLabel.Text</code>. I could do it with Page.FindControl, but this seems like a poor substitute to casting the previous page as a FirstPage object and referring directly to the MyTextBox control on it. Something like this; </p>
  
  <pre><code>// on the page_load of SecondPage.aspx;
  var previousPage = this.PreviousPage as FirstPage;
  this.MyLabel.Text = previousPage.MyTextBox.Text;
  </code></pre>
  
  <p>Is there any way to change the access modifier?</p>