Archive

Author Archive

Validation against Controls outside of the current NamingContainer

April 21st, 2009 Michael Bell 1 comment

I had a situation where I needed to do this recently. I googled of course, and came up with an overloaded FindControl method. I implemented this in my code, and all seemed well. UNTIL… came the time to get the data posted from my control. I had controls nested in a UserControl, and that usercontrol nested within a FormView. When the postback occurred, I was able to retrieve all values from controls directly in the formview but none from within the controls inside my usercontrol. A buddy of mine helped me out on this, and believe me.. it was no fun tracking down. the values “not being posted” was actually a flaw in the FindControl method override. Please use this piece of code in the naming container that your validators reside, if they in fact need to validate against controls outside:

protected override Control FindControl(string id, int pathOffset)
{
Control c = base.FindControl(id, pathOffset);
if (c != null)
return c;
return FindControl(Page, id);
}
public Control FindControl(Control parent, string id)
{
Control recurse;
if (parent.ID == id)
{
return parent;
}
foreach (Control child in parent.Controls)
{
recurse = FindControl(child, id);
if (recurse != null)
{
return recurse;
}
}
return null;
}
Categories: ASP.NET, Uncategorized, Whatever, c# Tags:

Yet Another TimePicker Update – DisplaySeconds

April 6th, 2009 Michael Bell 36 comments

I had several people tell me they would find it useful if there were a way to hide the seconds of the datepicker. For this reason, I created the DisplaySeconds boolean property. It’s also included in the TimePicker documentation.

Categories: .NET TimePicker Tags:

TimePicker Update

March 7th, 2009 Michael Bell No comments

As requested, I added functionality to the time picker to allow the up and down arrows on the keyboard to increase and decrease the values in the hours, minutes, seconds, and toggle the AM/PM box. I’ve also made the semi-colon seperators unfocusable.

Categories: ASP.NET, ASP.NET TimePicker Control, c# Tags:

ASP.NET TimePicker Documentation

February 27th, 2009 Michael Bell 8 comments

I finally got some documentation together for the TimePicker using Sandcastle and Docsite. For some reason I couldn’t get it to work as a subfolder or virtual directory of this site, so I have it on a funky port. Regardless, here is the link:

ASP.NET TimePicker Documentation

Categories: .NET TimePicker, ASP.NET, c# Tags: