Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 21, 2012 01:33 AM by Catherine Shan - MSFT
Member
202 Points
266 Posts
Feb 12, 2012 07:37 AM|LINK
I want to show a alert message as "Successfuly posted". in C#.Net code behind in asp.net.
Please send me the simple code for it
All-Star
95463 Points
14106 Posts
Feb 12, 2012 08:10 AM|LINK
ClientScript.RegisterStartUpScript()...http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerstartupscript.aspx
USe that to invoke Javascript from Server Side.,..
Thanks,
160 Points
55 Posts
Feb 12, 2012 08:55 AM|LINK
Hi,
Try this:
ClientScript.RegisterStartupScript(this.GetType(),"PopupScript","alert('Successfuly posted')",true);
Feb 12, 2012 10:09 AM|LINK
its not working
Participant
1205 Points
570 Posts
Feb 12, 2012 01:53 PM|LINK
this is working for me....try this
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Successfuly posted.');", true);
Feb 13, 2012 06:29 AM|LINK
muji85a its not working
What do you mean by not working? any error? Can you share your code, so that we can understand what you are talking about...
and in case of ajax, I would use ScriptManager.RegisterStartUpScript()...
Star
7756 Points
1626 Posts
Feb 13, 2012 06:39 AM|LINK
HI,
if you want simplest code then use javascript.
Eg:
in your .aspx page take div and make it run at server
<div id="divmessage" runat="server">
// C# code for successfull operation
// now use this js code. just after finishing your .cs code
divmessage.InnerHTML="<script language='javascript'>alert('successfully Posted.');</script>";
6 Points
5 Posts
Feb 13, 2012 08:30 AM|LINK
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "hello", "alert('Successfully Posted')", true);
This is working for me.
78956 Points
13402 Posts
MVP
Feb 13, 2012 08:35 AM|LINK
Refer here
http://www.aspsnippets.com/Articles/Display-MessageBox-in-ASP.Net-using-JavaScript.aspx
Contributor
3217 Points
1179 Posts
Feb 13, 2012 09:19 AM|LINK
try this
Response.Write(@"<script language='javascript'>alert('Test Message');</script>");
or
Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Message');</script>");
muji85a
Member
202 Points
266 Posts
alert in asp.net server side code
Feb 12, 2012 07:37 AM|LINK
I want to show a alert message as "Successfuly posted". in C#.Net code behind in asp.net.
Please send me the simple code for it
ramiramilu
All-Star
95463 Points
14106 Posts
Re: alert in asp.net server side code
Feb 12, 2012 08:10 AM|LINK
ClientScript.RegisterStartUpScript()...http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerstartupscript.aspx
USe that to invoke Javascript from Server Side.,..
Thanks,
JumpStart
Vijay Giggs
Member
160 Points
55 Posts
Re: alert in asp.net server side code
Feb 12, 2012 08:55 AM|LINK
Hi,
Try this:
ClientScript.RegisterStartupScript(this.GetType(),"PopupScript","alert('Successfuly posted')",true);
muji85a
Member
202 Points
266 Posts
Re: alert in asp.net server side code
Feb 12, 2012 10:09 AM|LINK
its not working
Nasir Hussai...
Participant
1205 Points
570 Posts
Re: alert in asp.net server side code
Feb 12, 2012 01:53 PM|LINK
this is working for me....try this
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Successfuly posted.');", true);ramiramilu
All-Star
95463 Points
14106 Posts
Re: alert in asp.net server side code
Feb 13, 2012 06:29 AM|LINK
What do you mean by not working? any error? Can you share your code, so that we can understand what you are talking about...
and in case of ajax, I would use ScriptManager.RegisterStartUpScript()...
Thanks,
JumpStart
vinay13mar
Star
7756 Points
1626 Posts
Re: alert in asp.net server side code
Feb 13, 2012 06:39 AM|LINK
HI,
if you want simplest code then use javascript.
Eg:
in your .aspx page take div and make it run at server
<div id="divmessage" runat="server">
// C# code for successfull operation
// now use this js code. just after finishing your .cs code
divmessage.InnerHTML="<script language='javascript'>alert('successfully Posted.');</script>";
V.K.Singh
CraztTech
Member
6 Points
5 Posts
Re: alert in asp.net server side code
Feb 13, 2012 08:30 AM|LINK
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "hello", "alert('Successfully Posted')", true);
This is working for me.
mudassarkhan
All-Star
78956 Points
13402 Posts
MVP
Re: alert in asp.net server side code
Feb 13, 2012 08:35 AM|LINK
Refer here
http://www.aspsnippets.com/Articles/Display-MessageBox-in-ASP.Net-using-JavaScript.aspx
Contact me
madan535
Contributor
3217 Points
1179 Posts
Re: alert in asp.net server side code
Feb 13, 2012 09:19 AM|LINK
Response.Write(@"<script language='javascript'>alert('Test Message');</script>");Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language=JavaScript>alert('Message');</script>");