title: Javascript confirm message problem
body: <p>I have a popup confirm box which i am able to show like below.</p>
  <p>But i dont know if the user clicked ok or cancel.</p>
  <pre><code>                ScriptManager.RegisterStartupScript(this, this.GetType(), &quot;ajax&quot;, &quot;&lt;script language='javascript'&gt;confirm('Do u wanna change?');&lt;/script&gt;&quot;, false);
  </code></pre>
  <p>so what i want to do is like this.</p>
  <pre><code>if (orignalId != newId)
                  {
   ScriptManager.RegisterStartupScript(this, this.GetType(), &quot;ajax&quot;, &quot;&lt;script language='javascript'&gt;confirm('Do u wanna change?');&lt;/script&gt;&quot;, false);
  
  If (user clicks Yes)
  {
  add some data to SQL
  }
  else
  {
  return;
  }
  }
  </code></pre>
  <p>How do i Know what the user has clicked??</p>
  <p>i have tried this</p>
  <ol>
  <li>i put the code below in a folder1\jscrip.js file but i dont kno how to call it as i have a used ajax update panel in the page so i cannot use ClientScript.RegisterClientScriptInclude to reference it. as mentioned in the 6th point at this link: <a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=274" rel="nofollow noreferrer">http://www.dotnetcurry.com/ShowArticle.aspx?ID=274</a></li>
  </ol>
  <blockquote>
  <p>Page.ClientScript.RegisterClientScriptInclude(&quot;selective&quot;, ResolveUrl(@&quot;folder1\jscrip.js&quot;));</p>
  </blockquote>
  <pre><code>function confirmation()
  {
  if(confirm(&quot;Are you sure?&quot;)==true)
  return true;
  else
  return false;
  }
  </code></pre>
  <p>Any suggestions???Thanks</p>
  <blockquote>
  <p>functionality:</p>
  </blockquote>
  <p>so the user clicks a button called &quot;Save first&quot; then in that it checks the condition &quot;if (orignalId != newId)&quot; if it is true the confirm box is shown or else no confirm box is shown.. now if the user clicks OK some values are enterd in DB or else it just returns and does nothing</p>
  <blockquote>
  <p>some extra code:</p>
  </blockquote>
  <pre><code>protected void Page_Load(object sender, EventArgs e)
          {
  if (!IsPostBack)
              {
              }
   else if (Label.Text != &quot;&quot;)
              {
                  Global.logger.Debug(&quot;Postback Happ, Label = &quot; + Label.Text);
                  Button2_Click(sender, e);
              }
          }
  
   protected void Button2_Click(object sender, EventArgs e)
          { if (orignalCsId != 0 &amp;&amp; newCsId != 0)
                  {
                      if (orignalId != newId)
                      {
                          Global.logger.Debug(&quot;Pop Up crossed1&quot;);
                          ScriptManager.RegisterStartupScript(this, this.GetType(), &quot;ajax&quot;, String.Format(CultureInfo.InvariantCulture, @&quot;__doPostback('{0}', confirm('Your Data From iD1 will be populated in iD2?').toString());&quot;, Label.Text), true);
                      }
                      else if (Page.Request[&quot;__EVENTTARGET&quot;] == Label.Text)
                      {
                          Global.logger.Debug(&quot;__EVENTARGUMENT1 = &quot; + Page.Request[&quot;__EVENTARGUMENT&quot;]);
                          bool userClickedOK = Boolean.Parse(Page.Request[&quot;__EVENTARGUMENT&quot;]);
                          if (userClickedOK)
                          {
                              // Add some data to SQL.
                          }
                          else
                          {
                              return;
                          }
                          Label.Text = &quot;&quot;;
                      }
                  }
            }
  </code></pre>