title: ASP Button Does Not Work In ContentPlaceHolder
body: <p>I'm new in using masterpages...
  I'm using an asp button control in my page...in a page without using masterpage my code works fine but when I use this code in a ContentPlaceHolder, the asp button doesn't work anymore...I googled this issue but can't solve this problem...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Eilya/Admin.master" AutoEventWireup="true" CodeFile="AddPainting2.aspx.cs" Inherits="Eilya_AddPainting2" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server"&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt;
  
  &lt;div id="mainDiv"&gt;
              &lt;asp:SqlDataSource ID="allIllustrationsSds" runat="server" 
                  ConnectionString="&lt;%$ ConnectionStrings:EilyaCString %&gt;" 
                  SelectCommand="SpAllPaintings1" SelectCommandType="StoredProcedure"
                  DeleteCommand ="SpDelPaintings" DeleteCommandType="StoredProcedure"&gt;
                  &lt;DeleteParameters&gt;
                      &lt;asp:Parameter Name="ID" Type="Int32" /&gt;
                  &lt;/DeleteParameters&gt;
              &lt;/asp:SqlDataSource&gt;
  
              &lt;asp:GridView ID="paintingsGrid" runat="server" AutoGenerateColumns="False" DataSourceID="allIllustrationsSds"
                  EnableModelValidation="True"
                  onrowcommand="paintingsGrid_RowCommand" onrowdatabound="paintingsGrid_RowDataBound"&gt;
                  &lt;Columns&gt;
                      &lt;asp:BoundField DataField="ID" HeaderText="شناسه" ReadOnly="True" 
                          SortExpression="ID"&gt;
                      &lt;/asp:BoundField&gt;
                      &lt;asp:BoundField DataField="title" HeaderText="توضیحات" 
                          SortExpression="title" ItemStyle-Width="609px"/&gt;
                      &lt;asp:TemplateField HeaderText="عکس اثر"&gt;
                              &lt;ItemTemplate&gt;
                                  &lt;img src = '&lt;%# ResolveUrl("../" + Eval("thumbnailUrl")) %&gt;' style=" width:91px;" /&gt;
                              &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                      &lt;asp:ButtonField ButtonType="Image" CommandName="btnDel" ImageUrl="../images/Eraser.png" HeaderText="حذف"&gt;
                          &lt;ItemStyle CssClass="ControlImg" HorizontalAlign="Center" VerticalAlign="Middle" /&gt;
                      &lt;/asp:ButtonField&gt;
                  &lt;/Columns&gt;
              &lt;/asp:GridView&gt;
  
              &lt;asp:SqlDataSource ID="sdsInsertIllustrations" runat="server" 
                  ConnectionString="&lt;%$ ConnectionStrings:EilyaCString %&gt;" 
                   InsertCommand="SpInsertPaintings" InsertCommandType="StoredProcedure"&gt;
                  &lt;InsertParameters&gt;
                      &lt;asp:Parameter Name="thumbnailUrl" Type="String" /&gt;
                      &lt;asp:Parameter Name="fullsizeUrl" Type="String" /&gt;
                      &lt;asp:Parameter Name="paintTitle" Type="String" /&gt;
                      &lt;asp:Parameter Name="cat" Type="Int32" /&gt;
                  &lt;/InsertParameters&gt;
             &lt;/asp:SqlDataSource&gt;
  
              &lt;asp:Label ID="lblMyAlert" runat="server" Text="Done!!!" Visible="False"&gt;&lt;/asp:Label&gt;
              &lt;table id="insertTable"&gt;
                  &lt;tr&gt;
                      &lt;td style="width:237px; background-color:#efefef;"&gt;
                          Thumbnail :
                      &lt;/td&gt;
                      &lt;td style="width:590px; background-color:#fff;"&gt;
                          &lt;input id="File1" runat="server" name="File1" style="width:480px;" type="file" /&gt;&lt;br /&gt;&lt;br /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td style="width:237px; background-color:#efefef;"&gt;
                          Main Pic :
                      &lt;/td&gt;
                      &lt;td style="width:590px; background-color:#fff;"&gt;
                          &lt;input id="File2" runat="server" name="File2" style="WIDTH: 306px; HEIGHT: 25px" type="file" /&gt;&lt;br /&gt;&lt;br /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td style="width:237px; background-color:#efefef;"&gt;
                          Title :
                      &lt;/td&gt;
                      &lt;td style="width:590px; background-color:#fff;"&gt;
                          &lt;asp:TextBox ID="title" runat="server" Width="590"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;&lt;br /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td style="text-align:center;"&gt;
                          &lt;asp:Button ID="btnInsertPaint" onclick="btnInsertPaint_Click" runat="server" Text="ثبت اثر" /&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/div&gt;
  
  &lt;/asp:Content&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>and my code behind is:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data.SqlClient;
  using System.Data;
  using System.IO;
  
  public partial class Eilya_AddPainting2 : System.Web.UI.Page
  {
      string cn = System.Configuration.ConfigurationManager.ConnectionStrings["EilyaCString"].ConnectionString.ToString();
      Int32 mx = 0;
  
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      void UploadFiles()
      {
          if (File1.PostedFile.FileName != "")
          {
              string StrFileType1 = File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.ToString().Length - 4, 4);
              File1.PostedFile.SaveAs(Request.PhysicalApplicationPath + @"\images\thumbnails\Paint_" + mx.ToString() + StrFileType1);
              string StrFileType2 = File2.PostedFile.FileName.Substring(File2.PostedFile.FileName.ToString().Length - 4, 4);
              File2.PostedFile.SaveAs(Request.PhysicalApplicationPath + @"\images\fullsize\Paint_" + mx.ToString() + StrFileType2);
          }
      }
  
      protected void btnInsertPaint_Click(object sender, EventArgs e)
      {
          ContentPlaceHolder MainContent = Page.Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
          MakeEId();
          UploadFiles();
          string flpth1 = "images/thumbnails/Paint_" + mx.ToString() + File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.ToString().Length - 4, 4);
          string flpth2 = "images/fullsize/Paint_" + mx.ToString() + File2.PostedFile.FileName.Substring(File2.PostedFile.FileName.ToString().Length - 4, 4);
          sdsInsertIllustrations.InsertParameters[0].DefaultValue = flpth1;
          sdsInsertIllustrations.InsertParameters[1].DefaultValue = flpth2;
          sdsInsertIllustrations.InsertParameters[2].DefaultValue = title.Text.Trim();
          sdsInsertIllustrations.InsertParameters[3].DefaultValue = "2";
          sdsInsertIllustrations.Insert();
          lblMyAlert.Visible = true;
          title.Text = null;
          flpth1 = null;
          flpth2 = null;
      }
  
      private void MakeEId()
      {
          try
          {
              SqlConnection con = new SqlConnection(cn);
              SqlCommand cmd = new SqlCommand();
              cmd = con.CreateCommand();
              cmd.CommandType = CommandType.StoredProcedure;
              cmd.CommandText = "SpMakePaintID";
              con.Open();
              SqlDataReader dbDR = cmd.ExecuteReader();
              while (dbDR.Read())
              {
                  mx = Convert.ToInt32(dbDR["ID"].ToString()) + 1;
              }
              con.Close();
          }
          catch { }
      }
  
      protected void paintingsGrid_RowCommand(object sender, GridViewCommandEventArgs e)
      {
          int index = Convert.ToInt32(e.CommandArgument);
          if (e.CommandName == "btnDel")
          {
              allIllustrationsSds.DeleteParameters[0].DefaultValue = paintingsGrid.Rows[index].Cells[0].Text.Trim();
              allIllustrationsSds.Delete();
              paintingsGrid.DataSource = null;
              paintingsGrid.DataSource = allIllustrationsSds;
              paintingsGrid.DataBind();
          }
      }
  
      protected void paintingsGrid_RowDataBound(object sender, GridViewRowEventArgs e)
      {
  
      }
  
      public override void VerifyRenderingInServerForm(Control control)
      {
          /* Confirms that an HtmlForm control is rendered for the specified ASP.NET
             server control at run time. */
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this is my MasterPage code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;%@ Master Language="C#" AutoEventWireup="true" CodeFile="Admin.master.cs" Inherits="Eilya_Admin" %&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;link rel="Stylesheet" type="text/css" href="../css/admin.css"  /&gt;
      &lt;asp:ContentPlaceHolder id="HeadContent" runat="server"&gt;
  
      &lt;/asp:ContentPlaceHolder&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div id="adminHeadDiv"&gt;
                  &lt;nav&gt;
                    &lt;ul&gt;
                      &lt;li id="homeTab"&gt;&lt;a href=""&gt;HOME&lt;/a&gt;&lt;/li&gt;
                      &lt;li id="newsTab"&gt;&lt;a href=""&gt;NEWS&lt;/a&gt;&lt;/li&gt;
                      &lt;li id="worksTab"&gt;&lt;a href=""&gt;WORKS&lt;/a&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;a href=""&gt;paintings&lt;/a&gt;
                                  &lt;ul&gt;
                                      &lt;li style="margin-top:-60px; width:400px;"&gt;&lt;a href="AddPainting1.aspx"&gt;Commandments | 2015&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddPainting2.aspx"&gt;φ | 2015&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;illustrations&lt;/a&gt;
                                  &lt;ul&gt;
                                      &lt;li style="margin-top:-60px; width:400px;"&gt;&lt;a href="AddIllustration1.aspx"&gt;placebo | 2015&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration2.aspx"&gt;φ | 2015&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration3.aspx"&gt;Amour | 2015&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration4.aspx"&gt;Coup de grass | 2014&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration5.aspx"&gt;Catharsis | 2014&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration6.aspx"&gt;In a heaven where no crow No scarecrow either | 2013&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration7.aspx"&gt;Primitive Fututre | 2013&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration8.aspx"&gt;Untitled Series | 2012&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration9.aspx"&gt;Sharh-al-Taaligheh | 2011&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration10.aspx"&gt;And I will Acervate with Love | 2010&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration11.aspx"&gt;Untitled Series | 2009&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration18.aspx"&gt;Great men are doing these acts | 2008&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration12.aspx"&gt;Oh Cow! thou will become immortal | 2005-2008&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration19.aspx"&gt;Shat-e-Ranj | 2007&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration13.aspx"&gt;The moon guest’s your eyes | 2007&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration14.aspx"&gt;Untitled Series | 2004&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration15.aspx"&gt;A man with a white mustache | 2004&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration16.aspx"&gt;Allegro | 2000-2003&lt;/a&gt;&lt;/li&gt;
                                      &lt;li style="width:400px;"&gt;&lt;a href="AddIllustration17.aspx"&gt;Untitled Series | before 2000&lt;/a&gt;&lt;/li&gt;
                                  &lt;/ul&gt;
                              &lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;photos&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;graphics&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;video art&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;performance art&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;installation art&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;sound art&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;etcetra&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li id="exhibitsTab"&gt;&lt;a href=""&gt;EXHIBITS&lt;/a&gt;&lt;/li&gt;
                      &lt;li id="mediaTab"&gt;&lt;a href=""&gt;MEDIA&lt;/a&gt;
                          &lt;ul&gt;
                              &lt;li&gt;&lt;a href=""&gt;books &amp; catalogs&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;posters&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;articles&lt;/a&gt;&lt;/li&gt;
                              &lt;li&gt;&lt;a href=""&gt;tv / video&lt;/a&gt;&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/li&gt;
                      &lt;li id="aboutTab"&gt;&lt;a href=""&gt;ABOUT&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                  &lt;/nav&gt;
              &lt;/div&gt;
          &lt;/form&gt;
          &lt;asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"&gt;
          
          &lt;/asp:ContentPlaceHolder&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>