usercontrols

.NET Interfaces

Over the past few years I've changed from having a long flowing page of controls that I hid/showed to using a lot of user controls. I've always had a bit of a discussion between co-workers on best practices. Should you have properties that you populate, or use paramterized sub's to load the information in your controls? Part of my fea...

User Control Property Designer Properties

For a C# UserControl on Windows Mobile (though please answer if you know it for full Windows...it might work) how do you change what shows up in the Designer Properties window for one of the Control's public Properties. For example: private Color blah = Color.Black; public Color Blah { get { return this.blah; } ...

Catching unhandled exceptions in ASP.NET UserControls

I'm dynamically loading user controls adding them to the Controls collection of the web form. I'd like to hide user controls if they cause a unhandled exception while rendering. So, I tried hooking to the Error event of each UserControl but it seems that this event never fires for the UserControls as it does for Page class. Did some ...

ASP.NET UserControl's and DefaultEvent

Outline OK, I have Google'd this and already expecting a big fat NO!! But I thought I should ask since I know sometimes there can be the odd little gem of knowledge lurking around in peoples heads ^_^ I am working my way through some excercises in a book for study, and this particular exercise is User Controls. I have cobbled together ...

user controls and asp.net mvc

Here is one trivial question, but I am not sure how to handle that. I need to display list of categories on every page, and to be able to choose items from specific category to be displayed. I use asp.net mvc, and chosen to create user control that will display categories. My question is: What is the best approach to pass data to user co...

Design problems with .Net UserControl

I have created a UserControl that has a ListView in it. The ListView is publicly accessible though a property. When I put the UserControl in a form and try to design the ListView though the property, the ListView stays that way until I compile again and it reverts back to the default state. How do I get my design changes to stick for t...

ASP.NET Custom Controls - Composites

Summary Hi All, OK, further into my adventures with custom controls... In summary, here is that I have learned of three main "classes" of custom controls. Please feel free to correct me if any of this is wrong! UserControls - Which inherit from UserControl and are contained within an ASCX file. These are pretty limited in what they...

Dynamic top down list of controls in WindowsForms and C#?

In our project, SharpWired, we're trying to create a download component similar to the download windows in Firefox or Safari. That is, one single top down list of downloads which are custom controls containing progress bars, buttons and what not. The requirements are that there should be one single list, with one element on each row. Ea...

Creating a UserControl Programmaticly within a repeater?

I have a a repeater that is bound to some data. I bind to the ItemDataBound event, and I am attempting to programmaticly create a UserControl: In a nutshell: void rptrTaskList_ItemDataBound(object sender, RepeaterItemEventArgs e) { CCTask task = (CCTask)e.Item.DataItem; if (task is ExecTask) { ExecTaskControl foo ...

NullReferenceException on User Control handle

I have an Asp.NET application (VS2008, Framework 2.0). When I try to set a property on one of the user controls like myUserControl.SomeProperty = someValue; I get a NullReferenceException. When I debug, I found out that myUserControl is null. How is it possible that a user control handle is null? How do I fix this or how do I find wha...

Update Panel inside of a UserControl inside of a Repeater inside of another UpdatePanel

Yes, it sounds crazy....It might be. The final updatepanel does not appear to trigger anything, it just refreshes the update panels and does not call back to the usercontrol hosting it. Any ideas? EDIT: I got it posting back, however the controls inside the final usercontrol have lost their data...I'm thinking its because the main rep...

How to program user preferences

I'm using Ruby on Rails for an internal site. Different users of the site have access to a wide variety of data and highly disparate perspectives of the data. Within those different classes of users, there needs to be levels of access. Within the levels of access I need to be able to add features from other classes of users. In the rele...

How to make user controls know about css classes in ASP.NET

Since there are no header sections for user controls in asp.net, user controls have no way of knowing about stylesheet files. So css classes in the user controls are not recognized by visual studio and produces warnings. How can I make a user control know that it will relate to a css class, so if it is warning me about a non-existing css...

DesignMode with Controls

Has anyone found a useful solution to the DesignMode problem when developing controls? The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE. The standard hack has been to look at the name of the process that is running and if it is "DevEn...

How to implement mouse dragging in Visual Basic?

I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the value of which is incremented/decremented by "grabbing" it with the mouse and moving the cursor up/down. Because the knob itself doesn't move, I need to keep tracking the mouse movement outside of the rectangle of the control. I use a Label with an ImageList...

How do I get the full url of the page I am on in C#

I need to be able to get at the full URL of the page I am on from a user control. Is it just a matter of concatenating a bunch of Request variables together? If so which ones? Or is there a more simpiler way? ...

Find item in WPF ComboBox

I know in ASP.NET I can get an item from a DropDownList by using DropDownList1.Items.FindByText Is there a similar method I can use in WPF for a ComboBox? ...

DefaultValue for System.Drawing.SystemColors

I have a line color property in my custom grid control. I want it to default to Drawing.SystemColors.InactiveBorder. I tried: [DefaultValue(typeof(System.Drawing.SystemColors), "InactiveBorder")] public Color LineColor { get; set; } But it doesn't seem to work. How do I do that with the default value attribute? ...

What web control library to use for easy form creation with many different types of input fields?

I'm about to create a web application that requires a lot of different web forms where the user needs to be able to input a lot of different types of information. What I mean is that one of those forms may require some text input fields, some integer input fields, some decimal input fields, some date input fields, some datetime input fie...

How to cache ASP.NET user controls?

I heard on a recent podcast (Polymorphic) that it is possible to cache a user control as opposed to the entire page. I think my header control which displays static content and my footer control could benefit from being cached. How can I go about caching just those controls? ...