Solved

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

Posted on 2004-09-01
4
1,042 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

636 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