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

Coded Step to Access RadGridView Cell Contents

2 Answers 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 14 Jan 2011, 07:56 PM
Hello, I am almost through evaluating the 2010 Q3 trial version of the WebUI Developer against a Silverlight application to see if it will work for us (Visual Studio 2010 and Silverlight 4 on Windows 7 with IE8).  The evaluation is very positive so far.

I am stuck at a point that probably has a very simple solution, but I have not seen any clues in the KB articles or in an existing thread.  I need to walk though a RadGridView a row at a time and extract the contents of the cells from the selected row.  Conceptually, I need something like

string cellText = selectedRow.Cells[n].Text

to access the contents of the cell in the "nth" column of the selected row, but I don't know how to make a reference to "selectedRow" in a coded step.  Any guidance in the solution is appreciated.

2 Answers, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 18 Jan 2011, 05:26 PM
Hello David, 
    you can achieve what you want without writing any code at all. That's the nice thing about WebUI Test Studio - it keeps coding to a minimum. Here's how you do it:
Launch a Recorder and navigate to the Silverlight page that contains the grid. You can pause the Recorder to avoid adding unnecessary steps to your test. Once you go to the page enable the Highlighting tool. Now move the cursor over the row which you'd like to access. After a few moments many options should appear (see screenshot 1). Each of these options opens the pop-up menu for a different element. We want to open it for RadGridRow so we click on that  (see screenshot 2). The pop-up menu appears. Now we want to add it to our project in order to access it from a Coded Step. So we click on "Add To Project Elements" (see screenshot 3).

The row is now added to the project elements - if you go to Visual Studio and take a look at the Elements Explorer - the newly added element will be highlighted with an arrow there (screenshot 4). Now you can access it from the code. Use the Elements Explorer to help you find it. In my case I can access the row with the following code:
Pages.HttpDemosTelerik.SilverlightApp.Item4Gridviewrow
Intelisense also help here.

Of course you can also write your own logic but why go through that trouble? 

I hope this helps, let me know if you have any other questions!

All the best,
Stoich
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
David
Top achievements
Rank 1
answered on 18 Jan 2011, 06:05 PM
Thank you very much, Stoich!
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Stoich
Telerik team
David
Top achievements
Rank 1
Share this question
or