Click here to Skip to main content
15,895,746 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Rest webservices Pin
Abhijit Jana1-Jun-09 23:50
professionalAbhijit Jana1-Jun-09 23:50 
GeneralRe: Rest webservices Pin
manowj2-Jun-09 4:32
manowj2-Jun-09 4:32 
Questionsql query Pin
jainiraj1-Jun-09 21:57
jainiraj1-Jun-09 21:57 
AnswerRe: sql query Pin
RajeevKumarSharma1-Jun-09 23:02
RajeevKumarSharma1-Jun-09 23:02 
GeneralRe: sql query Pin
jainiraj2-Jun-09 4:20
jainiraj2-Jun-09 4:20 
AnswerRe: sql query Pin
Christian Graus1-Jun-09 23:03
protectorChristian Graus1-Jun-09 23:03 
QuestionJava Scipt with Asp.Net Pin
Amit Patel19851-Jun-09 21:46
Amit Patel19851-Jun-09 21:46 
AnswerRe: Java Scipt with Asp.Net Pin
Abhishek Sur1-Jun-09 21:58
professionalAbhishek Sur1-Jun-09 21:58 
I use this code :

Alert class

using System.Web;
using System.Text;
using System.Web.UI;

/// <summary>
/// A JavaScript alert
/// </summary>
public static class Alert
{

/// <summary>
/// Shows a client-side JavaScript alert in the browser.
/// </summary>
/// <param name="message">The message to appear in the alert.</param>
public static void Show(string message)
{
   // Cleans the message to allow single quotation marks
   string cleanMessage = message.Replace("'", "\'");
   string script = "<script type="text/javascript">alert('" + cleanMessage + "');</script>";

   // Gets the executing web page
   Page page = HttpContext.Current.CurrentHandler as Page;

   // Checks if the handler is a Page and that the script isn't allready on the Page
   if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
   {
     page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
   }
}
} 


Now from Code-behind :
void btnSave_Click(object sender, EventArgs e)
{
   try
   {
     SaveSomething();
     Alert.Show("You document has been saved");
   }
   catch (ReadOnlyException)
   {
     Alert.Show("You do not have write permission to this file");
   }
}



If you dont want all this, just use :
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "alertkey", "alert(\"Successfully saved.\");", true);

Hope this would help you.
Rose | [Rose] Rose | [Rose]


AnswerRe: Java Scipt with Asp.Net Pin
Christian Graus1-Jun-09 23:01
protectorChristian Graus1-Jun-09 23:01 
Questionusing button in ajax accordion Pin
Ariful Islam Sabuz1-Jun-09 21:46
Ariful Islam Sabuz1-Jun-09 21:46 
AnswerRe: using button in ajax accordion Pin
Blue_Boy1-Jun-09 21:52
Blue_Boy1-Jun-09 21:52 
Questionkey Code value problem Pin
ais071-Jun-09 21:27
ais071-Jun-09 21:27 
AnswerRe: key Code value problem Pin
Blue_Boy1-Jun-09 21:59
Blue_Boy1-Jun-09 21:59 
QuestionHow to set DataSet as DataSource in web app ? Pin
hdv2121-Jun-09 21:06
hdv2121-Jun-09 21:06 
AnswerRe: How to set DataSet as DataSource in web app ? Pin
Abhijit Jana1-Jun-09 23:51
professionalAbhijit Jana1-Jun-09 23:51 
GeneralRe: How to set DataSet as DataSource in web app ? Pin
hdv2124-Jun-09 5:48
hdv2124-Jun-09 5:48 
AnswerRe: How to set DataSet as DataSource in web app ? Pin
K03063-Jun-09 20:38
K03063-Jun-09 20:38 
Questiondifference between dates Pin
Mathew P V1-Jun-09 21:05
Mathew P V1-Jun-09 21:05 
AnswerRe: difference between dates Pin
Colin Angus Mackay1-Jun-09 21:12
Colin Angus Mackay1-Jun-09 21:12 
GeneralRe: difference between dates Pin
Mathew P V1-Jun-09 21:20
Mathew P V1-Jun-09 21:20 
GeneralRe: difference between dates Pin
Colin Angus Mackay1-Jun-09 21:33
Colin Angus Mackay1-Jun-09 21:33 
GeneralRe: difference between dates Pin
Mathew P V1-Jun-09 22:30
Mathew P V1-Jun-09 22:30 
GeneralRe: difference between dates Pin
Colin Angus Mackay1-Jun-09 23:20
Colin Angus Mackay1-Jun-09 23:20 
GeneralRe: difference between dates [modified] Pin
Mathew P V1-Jun-09 23:57
Mathew P V1-Jun-09 23:57 
Questionhow to pass parameters to timer handler in asp.net Pin
Arif Liminto1-Jun-09 20:53
professionalArif Liminto1-Jun-09 20:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.