Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi Friends,
 
I had a major issue that in popupwindow which was closing more than 5 windows after that the application gets on hang. please let me know what mistake i did and what the solution to resolve. please help me on that.
 
Code:
 

<pre lang="c#"><pre>function loadPage()
    {
    
            var label = $('#lblPatientId');
 
            var g = label.text();
            $(function() {
 
                var scoresList = [{ TraitID: 1, TraitScore: 2 }, { TraitID: 2, TraitScore: 5}];
 
                $.ajax({ type: "POST",
                    url: "Tryouts.aspx/Test2",
                    data: JSON.stringify({ scores: g }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(response) {
                        if (response.d == true) {
                            // alert("success!!!!!");
                        } else {
                            // alert("problem!!!!!!!!!");
                        }
                    },
                    error: function(xhr) {
                        alert("ERROR");
                    }
                });
 
            });
            //    var responseText = "Done";
            //    return responseText;
            //    alert(g);
            //    return UnloadPageSynchronous('',  g);
            //            return UnloadPageSynchronous('<%# ResolveUrl("~/Services/Service.svc/updatmodify") %>','{"p_id":"' + g + '"}', "validStock");
        }
 

Body:
 
<body  önbeforeunload="return UnloadPage()"  önload="return loadPage()>
 

[WebMethod]
 public static bool Test(string scores)
 {
     List<object> PatientDetails = new List<object>();
     using (IARMSCLASSESDataContext ctx = new IARMSCLASSESDataContext())
     {
         bool valuessts = false;
         ctx.ImportDetails.Where(it => it.Patient_Account == scores).ToList()
                    .ForEach(
                        it => it.Lock_Flag = valuessts
                     );
         ctx.SubmitChanges();
 
         PatientDetails.Add(new
         {
             Id = scores,
             Status = "Record Released"
 
         });
     }
 
     return true;
 }
Posted 9-Apr-13 23:38pm
Edited 9-Apr-13 23:41pm
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi Vishnu,
 
modify the
dataType: "json"

as
dataType: "html"
 
In the Webmethod, it is not returning any json data, instead its just a bool. When it comes to js, we dont have such dataType in Ajax calls.
 
So, once look at that, and play a little with the debugger in the success property function. Also, try to return a string from the WebMethod.
 
It should help you. Let me know if this helped you or not.
 
Happy coding..!
 
Thank you,
Vamsi
  Permalink  
Comments
vishnumca123 at 10-Apr-13 5:50am
   
Hi Vamsi thanks for your reply,... But still i'm facing problem that i opened nearly 6 popup window and closing time that jquery event fire function was written but after 5 popup window close that application getting hang that another popup close event jquery was not firing...
please help me!
mvamsianil at 10-Apr-13 5:54am
   
Cant help you with small portion of your code Vishnu. You know that I dont have any information regarding the other 5 popups and their events and why you need 6 popups at a time. Also, let me know what exactly you are trying to do.
 
Also, try the same with a different browser (Chrome/FF) and see if you're getting the same issue or not.
vishnumca123 at 10-Apr-13 6:01am
   
Hi Vamsi,
 
First i have one grid like nearly 5000 records with link. once the link button clicked i calling the new window through the below code.
 
ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop Up", "newwindow=window.open('" + str + "','_blank','location=0,resizable=0,linkbar=0,ScrollBars=0,statusbar=1,status=0,toolbar=0,menubar=0,width=1124,height=650,left=20,top=10,moveable=0') ;newwindow.focus();", true);
 
2. At a single shot they will open 10 records in new window and do transactions. in that once they close browser the json code will trigger and release a record.
 
3.But here still 5 records closing time release is happening after 5 the application gets hanging.
 
<body önbeforeunload="return UnloadPage()" önload="return loadPage()>
mvamsianil at 10-Apr-13 6:24am
   
You said "popupwindow which was closing more than 5 windows". What are the 5 windows Vishnu.?
 
On link button click, we get 10 records from the grid. Isn't it?
 
You are updating 10 records at a time?
 
Explain point 3. Please read what you've written there and explain again properly. It doesn't make any sense to me.
 
How are you updating the grid? (Need Code here)
 
What do you mean by release/Closing time.?
 
I really cant help you with this kind of explanation. I need code to work on it. Understanding alone doesn't help at all..!

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

  Print Answers RSS
0 BillWoodruff 360
1 Mathew Soji 309
2 DamithSL 225
3 Afzaal Ahmad Zeeshan 202
4 Maciej Los 190
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web02 | 2.8.1411019.1 | Last Updated 10 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100