///
/// showAlert
///
public string showAlert(string msg)
{
string message = msg;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("");
return sb.ToString();
}
and then call above function like
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert",
showAlert("Student already admitted to this batch."));