title: Passing DataContext to a User Control
body: <p>I have a page that contains a dataset:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e) {
       MyDefinedDataContext mydatacont = new MyDefinedDataContext();
  }
  </code></pre>
  
  <p>I'd like to pass this datacontext through to a user control:</p>
  
  <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/Site2.Master" Inherits="WebApplication3._Default" %&gt;
  &lt;%@ Register src="inc/Tabular.ascx" tagname="Tabular" tagprefix="testing" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"&gt;
      &lt;testing:Tabular ID="tabularArticles" runat="server" currentPage="3" title="Articles"/&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>How can I do this? Would I do it in the user control's Page_Load somehow?</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          myCtx = mydatacont;
          this.setPreInfo();
          this.getTableInfo();
          this.setTableMeta();
      }
  </code></pre>