title: send value from client side to server side using C# in asp.net
body: <p>I'm trying to create a website content management using asp.net and C# and bootstrap. I already done this using asp.net and C# and a server control like gridview but I want create this version one like as wordpress CMS.<br>
  I will describe my project to clear my purpose.<br>
  First I fill a <code>DataTable</code> from database. This <code>Datatable</code> has <code>messageId int</code>, <code>Subject varchar</code>, <code>name varchar</code>, <code>email varchar</code>, <code>message text</code>, <code>isRead bit</code>, and so on columns.isRead column is bit type for specifies that the message is read or not.
  I Fill my DataTable using below Method:</p>
  
  <blockquote>
    <p><code>DataTable dt = cls.Fill_In_DataTable("MessageFetchMessage");</code></p>
  </blockquote>
  
  <p>Then I generate html text using another method dynamically: on Page_Load<br></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
     messeges = cls.fetchMessages();
  }
  </code></pre>
  
  <p>messege the string variable, will append generated html code to aspx page:<br></p>
  
  <pre><code>&lt;div class="row"&gt;
  &lt;div class="col-lg-12"&gt;
      &lt;div class="panel panel-default"&gt;
          &lt;div class="panel-heading"&gt;
              &lt;h3 class="panel-title"&gt;&lt;i class="fa fa-clock-o fa-fw"&gt;&lt;/i&gt; Last messages From users&lt;/h3&gt;
          &lt;/div&gt;
          &lt;div class="panel-body"&gt;
              &lt;div class="list-group"&gt;
                  &lt;%=messeges %&gt;
              &lt;/div&gt;
              &lt;div class="text-right"&gt;
                  &lt;a href="#"&gt;View All messages &lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>the message content has these text from <code>fetchMessages()</code>method:<br></p>
  
  <pre><code>public string fetchMessages()
  {
      string post = ""; string readed = "";
      DataTable dt = cls.Fill_In_DataTable("MessageFetchMessage");
      if (dt.Rows.Count&gt;0)
      {
          for (int i = 0; i &lt; dt.Rows.Count; i++)
          {
              DateTime dtTemp = DateTime.Parse(dt.Rows[i]["messageDate"].ToString());
  
              if (dt.Rows[i]["isRead"].ToString() == "True")
                  readed = "MessageReaded"; 
              else
                  readed = "MessageNew";
              post += "&lt;div class='modal fade' id='myModal" + dt.Rows[i]["messageId"].ToString() + "' tabindex='-1' role='dialog' aria-labelledby='myModalLabel'&gt;"
                  + "&lt;div class='modal-dialog' role='document'&gt;"
                  + "&lt;div class='modal-content'&gt;"
                  + "&lt;div class='modal-header'&gt;&lt;button type='button' class='close' data-dismiss='modal' aria-label='Close'&gt;&lt;span aria-hidden='true'&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;&lt;h4 class='modal-title' id='myModalLabel'&gt;&lt;span style='font-weight:bold'&gt;Subject&lt;/span&gt; : " + dt.Rows[i]["subject"].ToString() + "&lt;/h4&gt;&lt;/div&gt;"
                  + "&lt;div class='modal-header'&gt;&lt;p&gt;&lt;span style='font-weight:bold'&gt;Date&lt;/span&gt; : " + dtTemp.ToString("yyyy/MM/dd") + "&lt;/p&gt;"
                  + "&lt;p&gt;&lt;span style='font-weight:bold'&gt;Time&lt;/span&gt; : " + dt.Rows[i]["messageTime"].ToString() + "&lt;/p&gt;"
                  + "&lt;p&gt;&lt;span style='font-weight:bold'&gt;Email&lt;/span&gt; : " + dt.Rows[i]["email"].ToString() + "&lt;/p&gt;&lt;/div&gt;"
                  + "&lt;div class='modal-body'&gt;" + dt.Rows[i]["message"].ToString() + "&lt;/div&gt;"
                  + "&lt;div class='modal-footer'&gt;&lt;button type='button' class='btn btn-default' data-dismiss='modal'&gt;Close&lt;/button&gt;&lt;input type='submit' ID='btn" + dt.Rows[i]["messageId"].ToString() + "'  class='btn btn-danger' onserverclick='btn_Click' value='Delete message' /&gt;&lt;/div&gt;"    
                  + "&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;";
              string narrow = Special.TimeToNarrow(dt.Rows[i]["messageDate"].ToString(), dt.Rows[i]["messageTime"].ToString());
              post += "&lt;a data-toggle='modal' data-target='#myModal" + dt.Rows[i]["messageId"].ToString() + "' href='#' class='list-group-item " + readed + "'&gt;&lt;span class='badge'&gt;" + narrow + "&lt;/span&gt;&lt;i class='fa fa-fw fa-comment'&gt;&lt;/i&gt; &lt;span&gt;"
                   + dt.Rows[i]["name"].ToString() + "&lt;/span&gt; : &lt;span&gt;" + dt.Rows[i]["subject"].ToString() + "&lt;/span&gt;&lt;/a&gt;";
          }
      }
  
      return post;
  }
  </code></pre>
  
  <p>finally I add server code behind for btn_Click Event:<br> </p>
  
  <pre><code>protected void btn_Click(object sender, EventArgs e)
  {
      string id = (sender as Control).ClientID;
      //Then give Id to database class for CRUD Intractions
  }
  </code></pre>
  
  <p>but btn_Click never called from client side. I search for similar question within 2 days and didn't get answer. please help me :)
  <br>Here I will put my Website screen Shots:<br></p>
  
  <p><a href="https://i.stack.imgur.com/Jwu2k.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jwu2k.jpg" alt="enter image description here"></a>
  Then after click on one of the rows a pop up window will show using modal bootstrap:<br>
  <a href="https://i.stack.imgur.com/ML8uD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ML8uD.jpg" alt="enter image description here"></a></p>