Solved

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Checkbox in a dynamic GridVIew is not clickable? 5 37
What namespace do I need to import? 2 38
imap read mail 1 34
reading excel file in .net 2 14
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 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