Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

david vermeulen

@david vermeulen
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • WebUserControl, UpadtePanel And JavaScript Problem
    D david vermeulen

    Not sure if you have figured it out yet, but I think the problem is where you register your startup script. It should point to the page (page where the control is loaded) and not to the control itself. You can try : ScriptManager.RegisterStartupScript(this.Page,typeof(this.Page.getType()) ,"ScriptKey","alert('HI')", true); Hope this helps.

    ASP.NET help javascript

  • Asynchronous webmethods
    D david vermeulen

    Hi, I am fairly new to asp.net and need a bit of help please. In our project we are doing a callback from the client-side to the server side using a webmethod in order to try and keep the page request alive. From what I can see in Firebug is that, on the server side, the webmethod is triggered successfully from the javascript until I start with my async event on the server side, then the webmethod waits for it to be finished before the javascript calls the pagemethod again. However this process of ours can take anything from 1 minute to 40 minutes, so it is quiet essential that I keep the page request alive. I don't want to increase the timeout on the scriptmanager since I don't think that is the right way to approach this issue. Here is a small sample of how the code code is: Java script:

    function SimpleCallback() {
    var lCurrentStatus = PageMethods.GetCurrentStatus(ProcessResults);
    }

    function ProcessResults(pCurrentStatus) {
    if (pCurrentStatus != "Completed") {
    window.setTimeout("SimpleCallback()", 100);
    }
    }

    function SaveButtonClick(pArgument) {
    var lAjaxManager = $find("<%= MyAjaxManager.ClientId %>");
    lAjaxManager.ajaxRequest(pArgument);
    SimpleCallback();
    }

    <asp:Button ID="SaveButton" runat="server" Text="Save" OnClientClick="return SaveButtonClick('SaveStuff');"

    Server side code:

    [WebMethod]
    public static string GetCurrentStatus()
    {
    return FCurrentStatus;
    }

    protected void MyAjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
    if (e.Argument == "SaveStuff")
    {
    FCurrentStatus = "ProcessRunning";
    SaveInformation();
    }
    }

    //While this is being executed the webmetod, GetCurrentStatus, is ignored until this process is completed
    delegate void MyLongRunningProcess();

    private void SaveInformation()
    {
    var lLongRunningMethod = new MyLongRunningProcess(NextClass.Save());

    IAsyncResult lResult = lLongRunningMethod.BeginInvoke(null, null);

    while (!lResult.IsCompleted)
    {
    //Update progressbar with new percentage
    }

    lLongRunningMethod.EndInvoke(lResult);
    }

    Is there a way of doing the pagemethod call from javascript asynchronously, since it seems this is my problem. Or is there another way of approaching this in order to keep the page request alive? Thank you in advance, David.

    ASP.NET help csharp java javascript asp-net
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups