• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

How to create a LinkButtonTester object in NUnitAsp

How do I create a New LinkButtonTester using NUnitAsp for a LinkButton that is nested inside a DataGrid which is also inside an update panel which is also inside a ContentPlaceHolder?  

I cannot find the correct name to use so that NUnitAsp can find it on my page.
0
misdevelopers
Asked:
misdevelopers
  • 3
  • 2
1 Solution
 
MereteCommented:
Hi misdevelopers, well done
can this assist you as a starting point as I am no epert in this area really.
This guide contains a brief description of NUnitAsp and how to use it. It assumes that you're familiar with NUnit, ASP.NET, and unit testing
Quick start guide
http://nunitasp.sourceforge.net/quickstart.html
Overview
http://nunitasp.sourceforge.net/
Using NUnitASP to test DataGrid editing
http://www.cornetdesign.com/2005/07/using-nunitasp-to-test-datagrid.html

Good Luck
0
 
misdevelopersAuthor Commented:
Thanks!  Prior to posting my question here I had reviewed the sites you've mentioned.

In the examples, they give a name in the parameter for the name of the LinkButton, as follows:

LinkButtonTester updateLink = new LinkButtonTester("cmdUpdateReasonCode", editRow);

I create my asp datagrid control with an asp:ButtonColumn using the following code:

<asp:ButtonColumn CommandName="SelectClass" Text="Select Class"></asp:ButtonColumn>

There is no ID for this linkbutton that I can find to reference in the above parameter.  (SelectClass or Select Class doesn't work, I tried).
0
 
MereteCommented:
I'm just using google okay as I said I have no expertise in this so its pot luck lol.

Simple Insert, Select, Edit, Update and Delete in Asp.Net GridView control
http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx
0
 
misdevelopersAuthor Commented:
Well, that last link you found helped me solve the problem.  The problem was the way I was creating the linkbutton in the ASP.Net datagrid.

Solution:
Instead of:
     <asp:ButtonColumn CommandName="SelectClass" Text="Select Class"></asp:ButtonColumn>

You need to use:
     <asp:TemplateColumn>
           <ItemTemplate>
                <asp:LinkButton ID="ViewClasses" Text="View Classes" runat="server" CausesValidation="false" CommandName="ViewClasses"></asp:LinkButton>
            </ItemTemplate>
      </asp:TemplateColumn>

This gives the required Id to work with.

Thanks!
0
 
MereteCommented:
oh my god  that's awsome for you and makes very happy.
Cool. Thank you
Best Wishes
Merete
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now