Hi All,
I come across people were asking about, how to display alert messagebox after callback.
Im not sure this have been posted before or not, but i thought this is good to be share.
Below is the example:
C#
protected void Button1_Click(object sender, EventArgs e)
{
// Alert with messagebox after callback
// Assume your process take 5 second to complete
System.Threading.Thread.Sleep(5000);
// Build your alert script
StringBuilder sbScript = new StringBuilder();
sbScript.Append("");
ScriptManager.RegisterStartupScript(this, this.GetType(), "@@@@MyCallBackAlertScript", sbScript.ToString(), false);
}VB
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
' Alert with messagebox after callback
' Your process here e.g. add/edit/delete from database and etc
' Assume your process take 5 second to complete
System.Threading.Thread.Sleep(5000)
' Build your alert script
Dim sbScript As New StringBuilder()
sbScript.Append("")
' Make use ScriptManager to register the script
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "@@@@MyCallBackAlertScript", sbScript.ToString(), False)
' Your process here e.g. add/edit/delete from database and etc
' Assume your process take 5 second to complete
System.Threading.Thread.Sleep(5000)
' Build your alert script
Dim sbScript As New StringBuilder()
sbScript.Append("")
' Make use ScriptManager to register the script
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "@@@@MyCallBackAlertScript", sbScript.ToString(), False)
End Sub
1 comments:
Good Tips Thanks
Post a Comment