Lance Ahlberg's WebLog

Reflection on reason

More on getting NUnitAsp LinkButtonTester to work with VS2005

More on getting Nunitasp working with VS2005.  I have been having a problem with the LinkButtonTester, and it turns out that ASP.NET 2.0 doesn't like having “NunitAsp” as the Http Request UserAgent setting.   When I set the UserAgent to be Mozilla/4.0 the page was rendered correctly.

So if you are have problems with LinkButtonTester make sure you include the following in your test or test fixture setup..

Browser.UserAgent = "Mozilla/4.0";


I have recently encountered another issue with the LinkButtonTester. I had a page with a LinkButton, TextBox, and Field Validator.  The rendered page used a different javascript function called

WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(“test“,““,true,))

The LinkButtonTester didn't like this at all raising a parse exception.

It turns out that in ASP.NET 2.0 validation is also performed client side using various javascripts, and when a linkbutton is clicked it triggers the client side validation to occur.

So in order to turn off this behaviour and return to the old __doPostBack function I set the LinkButton's CausesValidation property to false.

 

 

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required)