Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi All,

In one of my webpages, i am trying for a confirmation message in a particular case.

So I have used following code in page load event:

VB
If cbxClose.Checked = True Then
                btnSave.Attributes.Add("onclick", "return confirm('Do you want to close Activity? Closed Activity cannot be reopened.')")
            End If


But the message is not opening and in debugging the above error is noted.

Pls suggest..

Thanks
Atul

Following is the code for save button:
Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click

       If txtSubject.Text <> "" Then       'Subject compulsary
           If txtTargetDate.Text <> "" Then
               Try
                   Dim varTargetDate As Date = DateTime.ParseExact((txtTargetDate.Text), "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture)

                   If ddlPerson.Text <> "" Then

                       If varmode = 1 Then      'ADD MODE
                           If varTargetDate >= Date.Today Then
                               Call fnAddActivity(varTargetDate)
                               Call subPageRefresh()
                           Else
                               fnMessage(Me, "Please enter today or later date.")
                               txtTargetDate.Focus()
                           End If

                       ElseIf varmode = 2 Then

                           If cbxReAllocate.Checked = True Or cbxClose.Checked = True Then
                               Call fnUpdateActivity()
                               Call subBacktoManage()
                           Else
                               Call subBacktoManage()

                           End If

                       End If   'mode selection
                   Else
                       fnMessage(Me, "Please select the Person")
                       ddlPerson.Focus()
                   End If

               Catch ex As Exception
                   fnMessage(Me, ex.Message)  'Primarily to chk the correct format of date
               End Try

           Else
               fnMessage(Me, "Please enter the Target Date")
               txtTargetDate.Focus()
           End If
       Else
           fnMessage(Me, "Please enter the Subject.")
           txtSubject.Focus()
       End If
   End Sub
Posted
Updated 25-Oct-14 7:21am
v3
Comments
[no name] 25-Oct-14 12:43pm    
The error is fairly genuine and there is no way to really stop it except from preventing it from being called or raised in the first place. As the runtime language will insist on the thread aborting once it has been called or raised. Call Thread.ResetAbort to cancel the abort if you have called to abort the thread.

However, I think there is something else in your code which is causing this, as there isn't enough code up there to make an analysis on.
Sergey Alexandrovich Kryukov 26-Oct-14 0:51am    
You are right. Somewhere in the code called Thread.Abort, but this line is not shown. This call can be legitimate or not, a bug or not. Before we know all about this case, there is nothing to discuss.
—SA
[no name] 26-Oct-14 1:11am    
Without seeing the requested routines and dll file I suggested below, we will never know. Atul vb, if the monitor.dll file is in your project, you must have written the class in order to compile it. Otherwise; why do you have a dll in there that you do not know what it does?
atul sharma 5126 26-Oct-14 1:40am    
monitor is the name of my solution. Are you suggesting to put whole project code here?
[no name] 26-Oct-14 8:41am    
In the project named ' Monitor ' you also have a class called Monitor, is this a DLL project or a asp project? (Just for clarity) Do you have other projects in your solution?

monitor.dll would appear to be a class file that has been compiled in your project and used in your project since it resides in your obj folder.

You will need to update your question and include the contents of this monitor class file. Also post the subroutine: subBacktoManage() and fnUpdateActivity()

What happens when you comment out these lines and run it:
Call fnAddActivity(varTargetDate)
Call subPageRefresh()
Call fnUpdateActivity()
Call subBacktoManage()

Are the errors gone?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900