Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am inserting a record. if executenonquery returns greater than 0. i kept in label record inserted successfully instead of label. i want it to display in JavaScript.

how can i do this please help me

thank you.
Posted

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using Ionic.Zip;
using System.Text;
using System.IO;


C#
public static void ShowAlertMessage(string error)
    {

        Page page = HttpContext.Current.Handler as Page;
        if (page != null)
        {
            error = error.Replace("'", "\'");
            ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "alert('" + error + "');", true);
        }

    }





Thanks
 
Share this answer
 
Try this after checking returning value..

Page.ClientScript.RegisterStartupScript(this.GetType(),"alert", "Record Inserted Successfully();", true);


have a good day.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900