srk1982
asked on
Showing message to a user with "Ok" button in a webform
Hi,
I want to show a message to the user.The message box shud have only "OK" button in it.
Once the user clicks that button, user shud be redirected to "Home.aspx".
Can it be done in c# itself or have to use js???
Urgent,
Thanks.
I want to show a message to the user.The message box shud have only "OK" button in it.
Once the user clicks that button, user shud be redirected to "Home.aspx".
Can it be done in c# itself or have to use js???
Urgent,
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi psychic_zero,
I have to call this javascript function in my pageload and not in a click event.
How to do that?
I have to call this javascript function in my pageload and not in a click event.
How to do that?
ASKER
Hi psychic_zero,
Page load of my code behind
like we give for a button click like this
btnDelete.Attributes.Add(" OnClick"," return ValidateDelete()");
in my case i just want to call that MsgBox() in the pageload of my codebehind.
Page load of my code behind
like we give for a button click like this
btnDelete.Attributes.Add("
in my case i just want to call that MsgBox() in the pageload of my codebehind.
Sorry I'm not quite understand with pageload of my codebehind. Or maybe you can give me the flow of how do you want it to work like:
From page "Intro.aspx" -> click on a "Home" button -> then a message box will appear said "You will be redirect to Home page" with OK button -> click OK button on the message box -> then the page will open "Home.aspx".
From page "Intro.aspx" -> click on a "Home" button -> then a message box will appear said "You will be redirect to Home page" with OK button -> click OK button on the message box -> then the page will open "Home.aspx".
ASKER
I want to call the msgbox() when the Intro.aspx page loads.
The reason why I want to call this msgbox() in codebehind of Intro.aspx because i have to check some session values there.
Thanks
The reason why I want to call this msgbox() in codebehind of Intro.aspx because i have to check some session values there.
Thanks
So you want function msgbox() to be executed automatically when page intro.aspx is load? Then how about try this code below. At the body tag, add onload function and see how it goes.
<body onload="MsgBox()">
ASKER
Hi psychic_zero,,
i dont want to do that in <body> tag, since this message has to come after checking some session values in my codebehind[c#].so, i have to do this in my codebehind only.
Anyway, i did that in c#, it is working now.
Thanks.
i dont want to do that in <body> tag, since this message has to come after checking some session values in my codebehind[c#].so, i have to do this in my codebehind only.
Anyway, i did that in c#, it is working now.
Thanks.
string strMessage = "Page not available for selected class.";
string strScript = "<script language=JavaScript>";
strScript += "alert(\"" + strMessage + "\");";
strScript += "window.location = \"admListQuote.aspx\"";
strScript += "</script>";
if (! (Page.IsStartupScriptRegistered("clientScript")))
{
Page.RegisterStartupScript("clientScript", strScript);
}
Open in new window