What is the difference between User Control, Custom Control and Component?

The main difference between User Control, Custom Control and Component is that they inherit from different levels in the inheritance tree: MyComponent |-> Component MyCustomControl |-> Control |-> Component MyUserControl |-> ContainerControl |-> ScrollableControl |-> Control |-> Component So, in short you get a different amount of pre-wired functionality with the different options. When would … Read more

ASP.Net: Literal vs Label

Yep, the main difference is that Literal controls just render out text, but Label controls surround it with <span> tags (Unless you use the AssociatedControlID property, in which case a Label control will render a <label> tag). So, labels can be styled easier, but if you’re just inserting text, literals are the way to go. … Read more

How to create a WPF UserControl with NAMED content

The answer is to not use a UserControl to do it. Create a class that extends ContentControl public class MyFunkyControl : ContentControl { public static readonly DependencyProperty HeadingProperty = DependencyProperty.Register(“Heading”, typeof(string), typeof(MyFunkyControl), new PropertyMetadata(HeadingChanged)); private static void HeadingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ((MyFunkyControl) d).Heading = e.NewValue as string; } public string Heading { get; set; … 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

How to get ALL child controls of a Windows Forms form of a specific type (Button/Textbox)?

Here’s another option for you. I tested it by creating a sample application, I then put a GroupBox and a GroupBox inside the initial GroupBox. Inside the nested GroupBox I put 3 TextBox controls and a button. This is the code I used (even includes the recursion you were looking for) public IEnumerable<Control> GetAll(Control control,Type … Read more

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