title: Access linkbutton from datalist on pageload with c# asp.net
body: <p>I have this linkbutton within a datalist and I'm trying to get access to the datalist on the pageload so i can set the linkbutton to be enabled or not based on the user's role.</p>
  
  <pre><code>&lt;asp:DataList id="dlRecommendations" runat="server" DataKeyField="Key" Width="900"&gt;
     &lt;ItemTemplate&gt;
        &lt;asp:LinkButton id="lnkEdit" Text="Edit" Runat="server" CommandName="Edit"&gt;    
        &lt;/asp:LinkButton&gt;
    &lt;/ItemTemplate&gt;
  &lt;/asp:DataList&gt;
  </code></pre>
  
  <p>Within the page load I want to be able to access the linkbutton to enable or disable it based on the user's role.</p>
  
  <pre><code> private void Page_Load(object sender, System.EventArgs e) {
    //perhaps something like this:
    lnkEdit.Enabled = false;
    ....
  }
  </code></pre>