Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-09-01
4
Medium Priority
?
1,044 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview

824 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