Solved

How can I use an alert popup from my .vb codebehind file...

Posted on 2004-09-01
4
1,034 Views
Last Modified: 2008-02-26
How can I use an alert popup from my .vb codebehind file?

I just want a message or alert box to state this.

"The data set contains more than 35000 rows.  Please narrow your search criteria."
0
Comment
Question by:Weller0123
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
jnhorst earned 500 total points
ID: 11958129
If you are doing it from a click event, when you test for dataset rows, if it is > 35000, do this:

string alertMsg = "The data set contains more than 35000 rows.  Please narrow your search criteria.";
string scriptMsg = "<script language='javascript'>alert('" + alertMsg + "');</script>"

Response.Write(scriptMsg);

John
0
 

Author Comment

by:Weller0123
ID: 11958140
thx...
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 11958145
An alternative to this, and this is how I usually handle this sort of thing, is to place a label control below the command button that causes the postback, but I set the Visible property to false on the label.  Then if certain conditions are met or excpetions are raised, I will put a message in the label.Text property and set the Visible property to true.  This causes the page to show the message in label without having to worry about JavaScript calls.

John
0
 

Expert Comment

by:softsolvers
ID: 12198222
here i have defined three different methods ,



1.///////////////////////////////////////////////////////////////
//for different events
Me.Button1.Attributes.Add("onclick", _
                   "return confirm('Are you sure you want to delete?');")



2.///////////////////////////////////////////////////////////////
//to use javascript on events of body load and unload functions

//declare it as globel
Protected WithEvents bodytag As HtmlGenericControl

//now use these line where ever required
bodytag.Attributes.Add("onload", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")



3.////////////////////////////////////////////////////////////////
//most simple method

Dim popupMsg = "<script language='javascript'>alert('Your password will expire soon');</script>"
Response.Write(popupMsg)



hey , buddy dont forget to mark my answer as accepted if you like it .
my mail id is  anugrah.atreya@softsolvers.com , bye
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now