mes = chpwd.updat(txtrpwd.Text, txtuname.Text);
if (mes)
{
Page.RegisterClientScriptBlock("mes", "<script language='javascript'>alert('New Password is Created')</script>");
string f = Session["flag"].ToString();
if (f == "L")
{
Response.Redirect("loginpage.aspx");
}
}
this code is working but message is not display, with out [Response.Redirect("loginpage.aspx")]
this line message box is display i want to display message with this line what can i do
vallimohan.n...
Member
18 Points
49 Posts
how to display message box in c# asp.net inside of codebehind
Jun 09, 2008 06:48 AM|LINK
mes = chpwd.updat(txtrpwd.Text, txtuname.Text);
if (mes)
{
Page.RegisterClientScriptBlock("mes", "<script language='javascript'>alert('New Password is Created')</script>");
string f = Session["flag"].ToString();
if (f == "L")
{
Response.Redirect("loginpage.aspx");
}
}
this code is working but message is not display, with out [Response.Redirect("loginpage.aspx")] this line message box is display i want to display message with this line what can i do"Asp.net 2.0"
jagan.unique
Participant
1286 Points
245 Posts
Re: how to display message box in c# asp.net inside of codebehind
Jun 09, 2008 07:29 AM|LINK
Hi
Change this line
To
Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('New Password is Created');", true);
anzer
Star
7928 Points
1506 Posts
Re: how to display message box in c# asp.net inside of codebehind
Jun 09, 2008 07:46 AM|LINK
Use this code.. It will work perfectly
mes = chpwd.updat(txtrpwd.Text, txtuname.Text);
if (mes)
{
string script = "alert('New Password is Created');\n";
script += "var f='" + Session["flag"].ToString() + "';\n";
script += "if (f == 'L')\n";
script += "location.href='loginpage.aspx';\n";
Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", script, true);
}
Here what am doing is I will check the condition and redirect from JS instead of from server side
ClientSideAsp.Net | Blog
sivakl_2001
Contributor
2849 Points
1069 Posts
Re: how to display message box in c# asp.net inside of codebehind
Jun 09, 2008 07:53 AM|LINK
hi why u post the same ques again
Talib_dotnet
Contributor
2162 Points
458 Posts
Re: how to display message box in c# asp.net inside of codebehind
Jun 09, 2008 07:53 AM|LINK
Hi,
You can do it in this way...
Response.Write("<script>alert('New Password is created')</script>");
Chief Technology Architect
MCTS
OnlineASP.Net
A-S-P Arabia...Consult Us