Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating my own event to pop up a confirmation box?

Status
Not open for further replies.

jen89

Programmer
Aug 16, 2001
105
US
I am writing an app that allows me to add search criteria, then click a search button to build and execute a query. I need to be able to provide a dialog box if the result set is > 1000 records so that the user can cancel if they want. I am aware of all the nasty problems involved with using popup message boxes in ASP.NET. I was trying to use the approach that would be like:

Code:
cmdCtrlSearch.Attributes.Add("onclick", "javascript:return confirm('Your query has resulted in lots of records. /n Retrieving this many records may take a long period of time. /n It is recommended that you canvel this search and refine your search criteria. /n  Do you want to continue?');")
I do this assignment in the onload event, works great.

However, my search function is more like:
Code:
sub search
.
.
BuildSearch()
AnalyzeQuery()
ExecuteQuery()
If ResultSet.Rows.Count > gMaxRows Then
    RaiseEvent maxRecordsExceeded()
End If
DisplayRecords()
end sub

Obviously, this is psuedocode :). As you can see, I raise an event called maxRecordsExceeded. I try to, anyways. I have never done this before, so I don't really know if I'm doing it right.

At the top of my page, I declared an event
Code:
Public Event maxRecordsExceded()

I changed the onLoad call to
Code:
cmdCtrlSearch.Attributes.Add("maxRecordsExceeded", "javascript:return confirm('Your query has resulted in lots of records. /n Retrieving this many records may take a long period of time. /n It is recommended that you cancel this search and refine your search criteria. /n  Do you want to continue?');")

I was hoping that what would happen would be that the raised event would be handled in the middle of the sub and pop up my message, but I'm thinking that it's not going to work Can anyone help me visualize how I could do this?
 
ur maxRecordsExceded()
needs to be in script tag. since ur registering it as javascript as i see it.


try it and let me know.
 
I'm not sure what you mean, I'm sorry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top