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

[Solved] Code Behind

3 Answers 31 Views
Telerik Testing Framework
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mridula Seshadri
Top achievements
Rank 1
Mridula Seshadri asked on 15 Oct 2009, 05:12 PM
I would like to access my RadGrid Control and count the dataitems in it , in my code.
Following is a code snippet. I get an outofrangeexception when I execute the following code. How else can I access my RadGrid control on my page?

public

 

void Count()

 

{

 

int records = 0;

 

 

try

 

{

 

 

 

 

records = this.Pages.Access_Direct__CheckUp.div_ContentPlac_RgSearchResults.MasterTable.DataItemCount;

 

 

this.Log.WriteLine(records.ToString());

 

}

 

catch (Exception ex)

 

{

 

this.Log.WriteLine(ex.ToString()); ;

 

}

 

}

3 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 15 Oct 2009, 06:51 PM
Hi Mridula,

This code looks as converted from a WebUI Test Studio .aii test and is correct in determining the DataItem count in a RadGrid instance on the page.

Can you please post the complete stack trace so that we can follow the execution? Also, can you share the version of RadControls for ASP.NET AJAX the application under test is built on?

Regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mridula Seshadri
Top achievements
Rank 1
answered on 15 Oct 2009, 08:44 PM
Konstantin ,

Thank you very much for your prompt reply.Please find below the stack Trace. In addition, please find attached a snapshot of the exception.

 at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at System.Collections.ObjectModel.ReadOnlyCollection`1.get_Item(Int32 index)
   at Telerik.WebAii.Controls.Html.RadGrid.get_MasterTable()
   at TestProject1.WebAiiTest1.Count() in C:\Documents and Settings\mseshadri\My Documents\Visual Studio 2008\Projects\TestProject1\TestProject1\WebAiiTest1.aii.cs:line 83

I am not very sure of the version of the Rad Controls but  I will let you know as soon as I get this information.

Thank you,
Mridula
0
Konstantin Petkov
Telerik team
answered on 15 Oct 2009, 09:08 PM
Hello Mridula,

Thank you for sharing the stack trace of the error.

It looks like the WebAii Testing Framework is unable to find the RadGrid MasterTable control. We can eventually handle the ArgumentOutOfRangeException and throw an appropriate error with message however the problem remains.

This confirms my suspicion the application under test is built on top of RadControls older release, probably from Qx 2008. Unfortunately the RadGrid rendering has been changed a bit this year which breaks the control wrapper in WebAii.

We researched the option of supporting older releases of RadControls and unfortunately our attempts completely failed. You can read more on the subject from this blog post.

If my suspicion about the older version of RadControls in the application under test is correct, I can only suggest upgrading the application when possible. Apart from the benefit from all the goodies the ASP.NET teams introduced this year, you will be also able to proceed with the test automation using either the WebAii Testing Framework or WebUI Test Studio. Please pass this along and let us know if we could be of further help.

Best wishes,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Telerik Testing Framework
Asked by
Mridula Seshadri
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Mridula Seshadri
Top achievements
Rank 1
Share this question
or