For Programmers: Free Programming Magazines  


Home > Archive > Extreme Programming > March 2004 > How to access element inside a row of DataGridTester?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to access element inside a row of DataGridTester?
Dominic

2004-03-26, 11:50 pm

Hi everybody,

I'm new to NUnitASP. I am evaluating how NUnitASP
works for my application.

A page in my application contains a data grid. For
example,

<asp:datagrid id="dgBookList" Runat="server"
AutoGenerateColumns="False" Width="100%">
<asp:TemplateColumn HeaderText="Title">
<ItemTemplate>
<asp:LinkButton ID="lbTitle" Runat="server"
Text=.....[some code deleted here]/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="ID" HeaderText="Book
ID"></asp:BoundColumn>
</asp:datagrid>

In my unit test code, I successfully got the data grid
tester working in the page.

DataGridTester dgtBookList = new DataGridTester
("dgBookList", someContainerControl);

I checked the dgtBookList.TrimmedCells. Everything
looked correct.

Now, I'd like to emulate clicking the link button "lblTitle"
inside the first row of the data grid.

DataGridTester.Row row = new DataGridTester.Row(1,
dgtBookList);
LinkButtonTester lbtTitle= new LinkButtonTester
("lbTitle", row);

The debugger showed the resulting LinkButtonTester
lbtTitle.Text has an
exception "NUnit.Extensions.Asp.WebForm.ElementNotVisi
bleException".

Do you know the reason? How can I access the element
inside the row of a DataGridTester?

Thanks
Dom
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com