Solved

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

Posted on 2004-09-01
4
1,035 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Rolling back a sequence of stored procedures 12 38
SSRS ReportViewer report timeout 7 104
error on the asp.net page 1 33
Anyway to make "All" the default in the dropdown? 6 34
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

13 Experts available now in Live!

Get 1:1 Help Now