Adding simple OK popup at the end of button executionhttp://forums.asp.net/t/1773309.aspx/1?Adding+simple+OK+popup+at+the+end+of+button+executionFri, 24 Feb 2012 08:35:23 -050017733094848736http://forums.asp.net/p/1773309/4848736.aspx/1?Adding+simple+OK+popup+at+the+end+of+button+executionAdding simple OK popup at the end of button execution <p>Hello all, in my ASP.NET 4.0 Web Application I have a button that save several data values in the database. I'd like to add a simple popup at the end of button work that shows only &quot;Data saved successfully&quot; (with only OK button in the popup). Mi button event is here:</p> <p>&nbsp;</p> <pre class="prettyprint">protected void btnSendRequest_Click(object sender, EventArgs e) { var accessDB = new AccessDB(); accessoDB.SaveData(DataCollection); System.Threading.Thread.Sleep(3000); btnSendRequest.Enabled = false; }</pre> <p>&nbsp;</p> <p>How can I add this popup?</p> <p>Thanks a lot.</p> <p>Luigi</p> 2012-02-24T07:36:24-05:004848747http://forums.asp.net/p/1773309/4848747.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>Just before the end of the method write</p> <p>Response.write(&quot;&lt;script type='text/javascript'&gt;alert('data saved successfully');&lt;/script&gt;&quot;);</p> 2012-02-24T07:40:29-05:004848760http://forums.asp.net/p/1773309/4848760.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>hi,</p> <p>try this,</p> <p>this for popup message..</p> <pre class="prettyprint">private void Message(string msg) { this.Page.ClientScript.RegisterStartupScript(typeof(Page), &quot;notification&quot;, &quot;window.alert('&quot; &#43; msg &#43; &quot;');&quot;, true); }</pre> <p>this one for to pass the Popup message</p> <pre class="prettyprint">protected void btnSendRequest_Click(object sender, EventArgs e) { var accessDB = new AccessDB(); accessoDB.SaveData(DataCollection); System.Threading.Thread.Sleep(3000); btnSendRequest.Enabled = false; //if condition for ur reference dont use this give ur actual condition if(success) { Message("Data Saved Successfully"); } } </pre> <p>Thanks&amp;Regards,</p> <p>Arunabathan.G</p> 2012-02-24T07:48:01-05:004848765http://forums.asp.net/p/1773309/4848765.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>In the first&nbsp;way I got this error:</p> <p>Row: 939 Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.</p> <p>L</p> 2012-02-24T07:50:27-05:004848782http://forums.asp.net/p/1773309/4848782.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>In this way nothing happens. Maybe the problem is due to the fact that the page is a userControl inside an aspx page?</p> <p>Luigi</p> 2012-02-24T08:00:54-05:004848785http://forums.asp.net/p/1773309/4848785.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>are you using UpdatePanel and ScriptManager? if yes , then you've to use ScriptManager.RegisterStartUpScript instead of the page class's&nbsp;RegisterStartUpScript method.</p> 2012-02-24T08:03:42-05:004848801http://forums.asp.net/p/1773309/4848801.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>Yes, the page has an UpdatePanel, but the ScriptManager is inside the masterPage, and in this way I can not reference it. How can I do?</p> <p>&nbsp;</p> 2012-02-24T08:12:35-05:004848856http://forums.asp.net/p/1773309/4848856.aspx/1?Re+Adding+simple+OK+popup+at+the+end+of+button+executionRe: Adding simple OK popup at the end of button execution <p>use</p> <p>(Master.FindControl(&quot;ScriptMangerID&quot;) as ScriptManager).Register.............</p> <p></p> <p>OR</p> <p></p> <p>delcare a property in MasterPage which returns the ScriptManager instance.</p> 2012-02-24T08:35:23-05:00