Click here to Skip to main content
15,880,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:


JavaScript
<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:

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



C#
[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
Updated 9-Apr-13 22:41pm
v3

1 solution

Hi Vishnu,

modify the
JavaScript
dataType: "json"

as
JavaScript
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
 
Share this answer
 
Comments
visnumca123 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!
RelicV 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.
visnumca123 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()>
RelicV 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)



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