Wednesday, January 21, 2009

My button doesn't work (Validation in a databound repeating control)

If you include validation controls in a templated control (GridView, Repeater, Accordion) make sure to set the ValidationGroup property of the validation controls to something that will resolve to a unique value for each item. If you don't do this, buttons may appear to stop functioning as the validator they are connected with is not the one you are working with in the given row.

An example of setting the ValidationGroup to something unique to each row might be:

ValidationGroup='<%# String.Format("RecordEdit_{0}",Eval("RecordID")) >%'

Thursday, January 15, 2009

<%# Eval() %>

This post describes the difference between these two data binding constructs:

<%# Eval() %>
and
<%# DataBinder.Eval() %>

Friday, January 02, 2009

When I implemented a global.asax file and its Application_Error() event handler, I got a vague "File does not exist" error along with the error number -2147467259. This blog post helped me to discover the missing file. Essentially, add the following line to the watch list and set a break point in Application_Error() to see the missing file:

((HttpApplication)sender).Context.Request.Url