Better way to find control in ASP.NET

If you’re looking for a specific type of control you could use a recursive loop like this one – http://weblogs.asp.net/eporter/archive/2007/02/24/asp-net-findcontrol-recursive-with-generics.aspx Here’s an example I made that returns all controls of the given type /// <summary> /// Finds all controls of type T stores them in FoundControls /// </summary> /// <typeparam name=”T”></typeparam> private class ControlFinder<T> where … Read more

How to find controls in a repeater header or footer

As noted in the comments, this only works AFTER you’ve DataBound your repeater. To find a control in the header: lblControl = repeater1.Controls[0].Controls[0].FindControl(“lblControl”); To find a control in the footer: lblControl = repeater1.Controls[repeater1.Controls.Count – 1].Controls[0].FindControl(“lblControl”); With extension methods public static class RepeaterExtensionMethods { public static Control FindControlInHeader(this Repeater repeater, string controlName) { return repeater.Controls[0].Controls[0].FindControl(controlName); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)