Showing posts with label AJAX. Show all posts
Showing posts with label AJAX. Show all posts

20091022

Working with Telerik & Ajax

Needed to have a button click on a Return Confirm to do an operation, and my button wasn't being clicked.
Turns out it was because I was having conflicting Ajax requests, got around it using this.

VB Code:  
RadScriptManager.RegisterStartupScript(Page, GetType(String), "confirm", "ProcessAnyway('" & btnProcessAnyway.ClientID & "','" & strMessage & "');", True)

JavaScript Code:
   function ProcessAnyway(strButtonIDToClick, strConfirmText)
    {
        var prm = Sys.WebForms.PageRequestManager.getInstance();

        //see if there is an Ajax request in progress.
        if (prm.get_isInAsyncPostBack())
        {
            //wait 1/4 second and try again (recursive)
            setTimeout(function() { ProcessAnyway(strButtonIDToClick, strConfirmText) }, 250);
        }
        else
        {
            //Yay, not AsyncPostBack run code
            ProcessAnywayAgain(strButtonIDToClick, strConfirmText);
        }
    }

    function ProcessAnywayAgain(strButtonIDToClick, strConfirmText)
    {
        if (confirm(strConfirmText))
        {
            document.getElementById(strButtonIDToClick).click();
        }
    }


20091007

ASP.NET 2.0 TreeView

Ugh, this control does not work with AJAX. It's giving me all sorts of horrible return values. Select Item # 3031, (CALLBACK! Change selection to 5608!). Now you have no idea what was clicked on. Have a nice day!

Will Likely switch to Telerik RadTreeView