How to create a LinkButtonTester object in NUnitAsp

Posted on 2007-10-05
Last Modified: 2013-11-26
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.
Question by:misdevelopers
    LVL 69

    Expert Comment

    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
    Using NUnitASP to test DataGrid editing

    Good Luck

    Author Comment

    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).
    LVL 69

    Accepted Solution

    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

    Author Comment

    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.

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

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

    This gives the required Id to work with.

    LVL 69

    Expert Comment

    oh my god  that's awsome for you and makes very happy.
    Cool. Thank you
    Best Wishes

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
    This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now