Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i have ajaxmodalpopup with some fields.....after inserting record into database....i want one error message that Record inserted suceesfully....


please help me
Posted
Comments
Avik Ghosh22 8-Feb-13 3:23am    
protected void Button1_Click(object sender, EventArgs e)
{
//your insart transaction part//

Page.RegisterStartupScript("Key", "<script type='text/javascript'>window.onload = function(){alert('inserted suceesfully');return false;}</script>");
}


try this...

First write this code in your .ASPX.

XML
<div id="divMessage" runat="server" class="" style="display: none;">
       <asp:Literal runat="server" ID="ltlMessage" Text="test"></asp:Literal>
   </div>



Then just write this code behind you .CS page.

C#
public static void ShowMessage(string _class, string msg, System.Web.UI.HtmlControls.HtmlGenericControl divMessage, Literal ltlMessage)
       {
           divMessage.Style.Add("display", "block");
           divMessage.Attributes.Add("class", _class);
           ltlMessage.Text = msg;
       }


C#
try
               {
                   UISettings.ShowMessage("alert alert-success", "Insert Successfully", divMessage, ltlMessage);
               }
               catch (Exception ex)
               {
                   ShowMessage("alert alert-error", ex.InnerException.Message, divMessage, ltlMessage);
               }
 
Share this answer
 
Comments
Member 9155255 1-Mar-13 0:52am    
Thank u
how to get alert message in asp.net[^]


or
C#
protected void Button1_Click(object sender, EventArgs e)
    {
        // insert part//
        Page.RegisterStartupScript("Key", "<script type='text/javascript'>window.onload = function(){alert('success');return false;}</script>");
    }
 
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