.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Javascript Alert after closing a modalpopup

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :ASP.Net


I have a linkbutton 'Forgot Password?' in my login page. On click of the link button  a modal popup will open . In that user has to give his username.

If the username doesnot exists  i want to show an alert 'Usename doesnot ' exists. 

Since the checking for the existenance of the username is on click of the button submit which is inside the modal popup, i can show the alert using the code

Page.ClientScript.RegisterStartupScript(...) . But I want something different

I want to call the javascript function after the maodal popup extender is closed

Please help me.



View Complete Post

More Related Resource Links

Closing Javascript Modal dialog window after server side event processing


Hello Friends..

Please tell me how to close Javascript ModelDoalog Window.. after Server Side event Processing .

Basically i want close window in  finally Block After sucessfulll Updation.

AMit..... InnocentInnocentInnocentInnocentInnocentInnocentInnocent

modalpopup and javascript error object required

Hi!   I Have this error when click on a button to open a popup box in my page: "object required"   Here is my code:   <%@ Page Language="VB" MasterPageFile="~/artm.master" AutoEventWireup="false" CodeFile="artm_principal.aspx.vb" Inherits="artm_principal" title="Principal" Debug="true" MaintainScrollPositionOnPostback="true"%><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AJT" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">                                      <AJT:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></AJT:ToolkitScriptManager>                                        <AJT:ModalPopupExtender ID="ModalPopupExtender1" runat="server"         &

showing modalpopup and saving data to database simultaneously using ajaxtoolkit and javascript

hi,i have a button ,i want that when i click on that button the data should be saved in the database as well as at the same time a modal popup should display the customerid .i have written the code as <asp:button id="save1" runat="server" onclick="Button4_Click" style=""z-index:" mode="hold" xmlns:asp="#unknown" /> left: 740px; position: absolute; top: 304px" Text="save"/> <asp:panel id="panel" runat="server" xmlns:asp="#unknown">  /asp:Panel> <ajaxtoolkit:modalpopupextender id="MPE" runat="server" targetcontrolid="save1" xmlns:ajaxtoolkit="#unknown"> PopupControlID="panel" DropShadow="true" BackgroundCssClass="modalBackground/> protected void Button4_Click(object sender, EventArgs e) { string id = TextBox1.Text; string name = TextBox2.Text; string cn = "Data Source=hcl;Initial Catalog=mydata;Integrated Security=True"; SqlConnection con = new SqlConnection(cn); SqlCommand cmd = new SqlCommand("insert into customer values (@id,@name)", con); con.Open(); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@id", id); cmd.Parameters.Add("@name",name); cmd.ExecuteNonQuery(); con.Close(); CUSTID.Text = id.ToString(); MPE.Show(); }

How do I stop ModalPopup from closing

I have a simple example of a ModalPopup with a panel that appears in the center of the ModalPopup and a couple of buttons in that panel. One of the buttons is a cancel and the other is an OK button. No matter how many other buttons that I add each one closes the ModalPopup. I need to keep the ModalPopup open so that I can run a few calculations then click a close button.  Any help is appreciated.

Font on Page Becomes Bold After Javascript Alert -- Why?

In .Net 3.5   I have a web page that has several checkboxes, text boxes, dropdown boxes etc on it.  When a user clicks on the search button, I run some basic validation on the page. If any validation fails, I invoke a javascript alert letting them know what they did wrong and I return them to the page. However, when the page reloads, all of the text on the page is now larger and bold, even the text inside the menu and which resides in a master page.  I removed every instance of the word "bold" from the project but it still becomes bold after the alert fires. Any idea what could be causing this to happen?  It shouldnt matter but here is a sample of the alert I use: Response.Write("<script language='javascript'>alert('You must check at least one column to display');</script>") Any help is greatly appreciated. thanks

Closing window in javascript without confirmation

Hello! I need to open a browser window without Toolbars, Status bar and Explorer bars (this means no back, refresh, ... buttons, no histiry, no nothing visible in this browser window). This is what I do: from normal browser window I open new window with all the properties I need and than I close the first window: <body>     <script type="text/javascript">  window.open('login.aspx','','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,                        left=0px, top=0px,width=1024, height=768');  window.close();     </script> </body> This would be OK if the first window would just close, but it doesn't. I get the confirmation window with this text: The Web page you are viewing is trying to close the window. Do you want to close this window? I don't want user to have to close the window manually. Can somebody please tell me how to close browser window without the confirmation popup? Thnx in advanced, dvale

javascript alert window when dropdown field is selected,



is there a way..where an alert window prompts up to remind the user to select a checkbox when one field in dropdown is selected..for example

there is a dropdown field(Status)  which contains (Tobe confirmed, confirmed and rejected ), when confirmed is chosen..an alert window prompts up reminding the user to select a checkbox(send email) - Yes or No. It is not compulsory for the user to select the checkbox, but if Yes is chosen, the workflow will send an email

Closing ModalPopup from an embedded iframe


I want to put an iframe inside of a ModalPopup and then have a button click on a button inside the iframe trigger the close of the ModalPopup.  I am guessing this is possible by simply attaching a function to the onclick event of the button in the iframe that navigates the DOM to call a javascript function in the parent that ultimately closes the ModalPopup.  Now the targetId of my ModalPopup is a div, so I could see hiding the div manually to "close" the ModalPopup, but I was wondering if there are already functions built into the scriptlib for the ModalPopup that will allow me to open or show and close or hide it?  If so, how do I access those functions client side?  Are they documented anywhere?


Thanks in advance!

javascript script works with alert() and does not fully work without it



Im facing the following problem i have a gridview that i insert an OnClick event to each row in order to be able to click on a row and selecting that row (change the color of the selected row e.tc) my javascript works fine when i have an alert when i remove the alert

then i see the color of the row changing as i click it but then when i move the mouse the color changes back to normal i still get the id of the row since i have a textbox where i put the id content of the e.row.cell[0] value .

I searched the web and i found out that its something to do with ajax and asychronous calls here is the code if the alert is enabled everything works fine this function is called from .c#

protected void GrdEntal_RowDataBound(object sender, GridViewRowEventArgs e)
            if (e.Row.RowType == DataControlRowType.DataRow)

                e.Row.Attributes.Add("onclick", "javascript:getID('" + e.Row.Cells[0].Text + "', '" + e.Row.ClientID + "', '

Javascript alert vs postback


My aim is to not cause a postback if a session var does not equal a certain value when the user clicks the DELETE button. But this causes a postback regardless after the javascript alert is invoked.

I guess I need another logical scenario?




how to do a javascript alert from a another public class


I'm using the ReportGenerator.cs class and this class is referenced from the actual calling page Default.aspx and Default.aspx.cs

using GeneraReport;

in the Default.aspx.cs

and the code in GenerateReport.cs:

namespace GeneraReport
    public class ReportGenerator

This namespace has no reference to Page

However I need to be able to do the following in the public class:

      if (dt.Rows.Count == 0)
                        string Script = "";
                        Script += "<script language=JavaScript id='NoRows'>";
                        Script += "alert('No Rows Found in Query');</script>";

javascript alert msg


I have an app with many pages where in the page load event I check for a session variable   Session("usr") being populated or not.

If it is not I then use the following few lines of code to initiate a JS function that is loaded into each page via an include statement.

It works fine, except for this one page.  Any ideas:


Code Behind:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim bldvw As base = New base

Dim cm As ClientScriptManager = Page.ClientScript

Dim cbReference As String

 'see if session has timed out

If bldvw.validateUsr = 0 Then

If (Not ClientScript.IsStartupScriptRegistered("")) Then

cm.RegisterClientScriptBlock(Me.GetType(), "alert", "logout();", True)  

' above line is actually hit each time, but the alert msg never comes up

End If

End If

<-- more code  irrelevant to this task--->

end sub

Public Function validateUsr() As Integer

If Session("usr") = "" Or Session("usr") = Nothing Then

validateUsr = 0


validateUsr = 1

End If

Return validateUsr

End Function




how to use javascript message("alert) in System.Web.IHttpHandler


hello every one i using system web handler when System.Web.IHttpHandler

           save the record than how can show message "Record is saved"

multiple line javascript alert in codebehind c#


I'm trying to put line breaks in my alert that's in a Response.Write like this:


Response.Write("<script>alert('" + dr["display_title"].ToString() + "\n is " + dr["display_title"].ToString().Length + " characters. Title cannot exceed 100 characters. Please limit all titles to 100 characters or less.')</script>");


with the \n  character, but instead of the alert showing up on multiple lines in the dialog box, the alert itself is breaking up into multiple lines like this:

alert('some text

more text

more text')


How would I get this to work correctly? Thanks

Dateandtime control and alert in javascript


I am using a dateandtime sharepoint control.

On selection of a date, I need to display an alert box from javascript.

1.Where to write the javascript?

2. Which event needs to be called?

Please help me with this.

ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend