This is a migrated thread and some comments may be shown as answers.

Wait for AJAX Postback

1 Answer 137 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 20 Jan 2012, 04:41 PM
I have a DropDownExtender that is an ajax postback control.  I believe my script is breaking because the import has not finished and waiting for the first element does not seem to work.  I have found this link:

http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/html/ajax-postback.aspx

From that link I tried entering the following line of code in an existing function by Customizing step in code:

public bool ActiveAjaxConnections()
{
    return Actions.InvokeScript<bool>("Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()");
}


However, I get the following errors:
 Line 107: (BC30205) End of statement expected.
 Line 108: (BC30035) Syntax error.
 Line 109: (BC30647) 'Return' statement in a Sub or a Set cannot return a value.
 Line 109: (BC30037) Character is not valid.
 Line 110: (BC30035) Syntax error.
 Line 113: (BC30429) 'End Sub' must be preceded by a matching 'Sub'.


Here is the code in view class:

  <CodedStep("Wait for Ajax")> Public Sub WaitAjax()
public bool ActiveAjaxConnections()
{
    return Actions.InvokeScript<bool>("Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()");
}
End Sub

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 20 Jan 2012, 05:04 PM
Hello Jonathan,

Are you coding in Visual Basic? All samples from the article you referenced are written in C#. Simply covert the code on our site and plug the result into the code-behind file instead.

All the best,
Anthony
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Share this question
or