vivek jain vivek jain - 2 months ago 16
ASP.NET (C#) Question

Javascript alert is not working in Update Panel in asp.net

I am working on asp.net web application.
I have one UpdatePanel and there is table inside table which has data in some TextBoxes.

I have one save button too inside this UpdatePanel
So I want to save this data into Database, when I click Save Button.

This is working fine till now.

But I want to show alert message to User that information saved successfully. I'm using javascript for this purpose, But Javascript is not working.
so is this possible to achieve the desired functionality using javascript, if yes then please guide me Or if there is any other alternative method except this please let me know.

Thanks,
Vivek

Answer

If you have update panel use ScriptManager.RegisterClientScriptBlock as below

ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Member Registered Sucessfully');", true)

Remember that you can't use Response.Write during an asynchronous postback.

It would be good if you have posted your code here.

Comments