title: how to identify submit() from javascript function and why it's not works
body: <p>I have a list of users that in the end of each line in the table I added two links("href"): one for "update" user and secend for "delete" user. So for enable that I added a call to javascript function that capture the ID of user and set another field to "true" and insert these values to some form that I created before (form with only two "hidden" field), and then the function activated submit() operation to the server part (asp.net code).</p>
  
  <p>I checked and the submit() operation works ok(checked with respons.write("-----")...)</p>
  
  <p>But I know how to recognize a submit form button inside IsPost by ask what the value of the submit button (for example: if(Request.Form["ExpertButton"]== "delete"){..some code here....})</p>
  
  <p>But when I activate submit() with javascript, how could I recognize post? I tryed with the value of the hidden field but it's not capture this and it skiped of the if statement....</p>
  
  <p>another problem that I found with debug is that the browser(IE9) throw error when the function
  submit() happens... </p>
  
  <p>the list of users code:</p>
  
  <pre><code>foreach(var row in db.Query(displayExperts,nameOfExpert))
                  {
                  &lt;tr&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.ExpertID&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.name&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.password&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.allowBonds&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.allowStocks&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.allowExchangeTraded&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;@row.allowMutualFund&lt;/td&gt;
                       &lt;td class="dispExpertActScreen"&gt;&lt;a href="#" onclick="expertToDelete('@row.ExpertID') ;return false;" style="color: #b04e4e"&gt;update&lt;/a&gt;&lt;/td&gt;
                      &lt;td class="dispExpertActScreen"&gt;&lt;a href="#" onclick="expertToDelete('@row.ExpertID') ;return false;" style="color: #b04e4e"&gt;delete&lt;/a&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  }
  </code></pre>
  
  <p>the form:</p>
  
  <pre><code>&lt;form method="post" name="deleteExpert" style="font-size: medium; margin-top: 10%" dir="rtl"&gt;
      &lt;input type="hidden" name="expertID" id="expertID" value=""&gt;
      &lt;input type="hidden" name="txtJavascriptMode" id="txtJavascriptMode" value=""&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>the function:</p>
  
  <pre><code>&lt;script&gt;
  
      function expertToDelete(expertID) {
  
          document.getElementById('expertID').value = expertID;
          document.getElementById('txtJavascriptMode').value = 'true';
          document.getElementById('deleteExpert').submit();
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>the asp.net code:</p>
  
  <pre><code>@{
      var db = Database.Open("MyProjectSite");
      var display="no";
      var displayExperts="";
      var nameOfExpert="";
      var category="";
       if(IsPost)
      {
          if(Request.Form["ExpertButton"]== "search")// this is by button!!!
          {
               some code.....
  
          }
  
          Response.Write("----");
           if(Request.Form["txtJavascriptMode"] == "true")
           {
              var id=Request.Form["expertID"];
              var deleteQuery="DELETE FROM InvestmanExperts WHERE ExpertID=@0";
              db.Execute(deleteQuery,id);
           }
      }
      db.Close();
  }
  </code></pre>
  
  <p>Another strange somthing is when I put this line:</p>
  
  <pre><code>Response.Write("----"+Request.Form["txtJavascriptMode"]);
  </code></pre>
  
  <p>before:</p>
  
  <pre><code>if(Request.Form["txtJavascriptMode"] == "true");
  </code></pre>
  
  <p>the website indentation looks bad but the delete line of user works OK, why?</p>
  
  <p>thanks...</p>