/* ------------------------ My Meta Content Here SEO ------------------------ */

Pages

Main Menu

Sunday, November 18, 2012

ASP.NET show alert message from server side

If you want to show msg if you are posting the page to server through update panal (asynchronous postback) then you have to use this function.

//During Asynchronous Post Back in Update Panal Use ScriptManager (Inside Update Panal)
public void alertBox(string Message)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(),"Key", string.Format("alert('{0}');", Message), true);
}


If you want to show message in browser and want to show it through javascript (alert function)
then use this function.

// During synchronous normal Post Back Use ClientScript
public static void ShowMessage(string MessageText, PageMyPage)
{
MyPage.ClientScript.RegisterStartupScript(MyPage.GetType(),
"MessageBox", "alert('" + MessageText.Replace("'", "\'") +"');", true);
}
Read More »

My Blog List

  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी संतान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    2 months ago
  • काश - काश मुझे भी पीने की आदत होती,मैं कब का मुर्दा हो गया होता। छुटकारा मिलता आज के आतंकवाद से, किसी शमशान भूमि में सो गया होता। मेरा एतबार कौन करेगा, मैंने मुर...
    2 months ago
  • Kumaon University Nainital B.Ed entrance exam test result 2012 - कुमाऊँ विश्वविधालय, नैनीताल (उत्तराखण्ड)
    10 years ago