Reputation: 1171
protected void ddlLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlLanguage.SelectedValue=="es-ES")
{
Page page = HttpContext.Current.CurrentHandler as Page;
page.ClientScript.RegisterStartupScript(typeof(Page), "Script", "<script language='javascript'>alert('All content may not be in Spanish. Do you want to continue...');</script>");
}
}
All I want to do is display a simple alert box but all in vain...nothing pops-up. need some ayudar.
Upvotes: 1
Views: 4927
Reputation: 41
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "showalert","Alert Message", true);
This works for me without Postback try this
Upvotes: 0
Reputation: 2750
You need to verify if the startup script is not registered already. Check out this post.
Also you can build your custom MessageBox in ASP.NET. Check out this one.
Upvotes: 2
Reputation: 6123
You can also achieve in this way
protected void ddlLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlLanguage.SelectedValue=="es-ES")
{
Response.Write("<script>alert('All content may not be in Spanish. Do you want to continue...');</script>");
}
}
Upvotes: 2