title: How to create an asp:button programmatically in c# behind (without click handling)
body: <p>The following button provides the exact functionality I require, but it must be done programmatically as I will be making more than one based on some variables, but the latter I can figure out if I can just create the button below as a starter:</p>
  
  <pre><code>&lt;asp:Button runat="server" OnCommand="Load_Items" CommandArgument="1" text="Submit" /&gt;
  </code></pre>
  
  <p>More information on what I've been doing <a href="https://stackoverflow.com/questions/17884044/method-being-triggered-on-page-load-but-not-via-asp-button/">here</a>.</p>
  
  <p>Edit:</p>
  
  <p>I have looked at questions <a href="https://stackoverflow.com/questions/188007/creating-an-aspbutton-programatically">like this</a>, but don't see where to go from <code>Button btnSave = new Button();</code> to seeing a button on the page. Also, most questions I've found seem to go about using C# to handle clicking, but I want to have an OnCommand property to handle it.</p>
  
  <p>If I do the following and search using the developer tools for "btn", I get no results.</p>
  
  <pre><code>Button btnSave = new Button();
  btnSave.ID = "btnSave";
  btnSave.Text = "Save";
  btnSave.CssClass = "btn";
  </code></pre>