Coded Step to Access RadGridView Cell Contents

3 posts, 0 answers
  1. David
    David avatar
    12 posts
    Member since:
    Sep 2010

    Posted 14 Jan 2011 Link to this post

    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. Stoich
    Stoich avatar
    1 posts

    Posted 18 Jan 2011 Link to this post

    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:
    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,
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  3. David
    David avatar
    12 posts
    Member since:
    Sep 2010

    Posted 18 Jan 2011 Link to this post

    Thank you very much, Stoich!
Back to Top