What's hot ? (and I mean really ...) - scroll down for more
1).  Code Templating - advanced usage of delegates & generics: my slides & demos are available for download! CodeProject article is also available.

2).  My series "TDD in the eyes of a simpleminded" is in progress(including code!): preface, part1, part2, Q&A 1, Manual Stub .vs. Mock Stub

3).  TDD Workshop: SeeCompass v0.1 and v0.2 are out.
# Monday, February 12, 2007

In one of our screens, we have a list of items on the left pane and "details" screen on the right pane. The details pane appears only when one of the items is selected. If no item is selected - we show some sort of empty pane that describes the usability of the screen and ask the user to select an item in order to continue.

In order to switch between the details\empty panes, I draw two span elements and played with their visibility property. The controls are partially rendered which means that if the user did not select an item, no "details" controls or rendered and neither their validators. The problem is that ASP.NET register the validators only once (via ValidatorOnLoad() method) and on the first time the screen is rendered, the controls are not there yet (no item is selected by default).

The solution was pretty straight-forward, I think. I've downloaded a simple call to my javascript method so the validators will be re-attached again:

ScriptManager.RegisterStartupScript(this, this.GetType(), "HookupManuallyToValidators", "ReRegisterValidators();", true);

And the javascript method:

function ReRegisterValidators()
{
   if (typeof(Page_Validators) == "undefined")
      return;

   var i, val;
   for (i = 0; i < Page_Validators.length; i++) 
   {
        val = Page_Validators[i];
        ValidatorEnable(val, true);
   }
}

1-0 to lnbogen .vs. asp.net

Posted by Oren Ellenbogen 
12/02/2007 05:09, Israel time UTC+02:00,     Comments [1]  | 
Wednesday, February 21, 2007 5:51:17 PM (Jerusalem Standard Time, UTC+02:00)
Great post.
you saved me.... i had this problem today .....
and your post came in the right time :)
cheers !
Tamir
Comments are closed.