usercontrols

When to add a Component Class vs User Control?

I have a general idea, and there are some obvious cases, but there are also some gray areas for me - when is it best to use to extend from a component and when is it best to create a user control ? This pertains to a specific work problem I am trying to solve, but the specifics of that are not important - a general answer to this questi...

ASP.Net User Control - VS Event Wireup

So i've got a custom user control. I have an event (SelectionChanged) and I'm wanting to have who ever uses my control to do the following to hook up the event: drag the control to the page in designer mode, click on the control view the controls event handlers (from the properties window) find the SelectionChanged event double click a...

How do I create a banner panel in C#?

I want to create my own custom control that is basically a TableLayoutPanel with 3 rows and 1 column. The top and bottom rows will contain labels (banners) and the middle row is where I will add other controls. The problem is that when I try to build other forms/controls from this control, the designer doesn't recognize the middle pane...

Use webservice referenced in WPF UserControl

Hi I have a wpf app with a usercontrol, within the user control I want to call a referenced webservice. What is the code syntax to do that? I can't seem to figure it out. Thanks, CC ...

Interacting with User Controls through Events

I've browsed through the questions on the site, but haven't found a decent answer yet. My problem is that my main form class is cluttered due to all the events and methods. I decided to break the form into user controls. Unfortunately I am having trouble accessing information from other User controls. For example I have a user control...

Addin Property To a user_created Component

Hi to all, I've written a windows form control library. I've used it at my main desktop (form) application. But I can not see the properties I have added my control library ! The way to add property to a user_created component is possible with working on class view. But I can not make my properties shown in properties windows like othe...

Why are controls within custom panel (C# winforms) disappearing in designer?

I have been able to create a custom C# winforms control that is basically a panel with a fixed banner (header/footer). I want to base other user controls on this "banner panel". I've gotten past the problem with the designer here. I can successfully add controls to the inner content panel. Everything looks fine while designing. Howe...

.Net User Control Interface

I have a very basic application that has buttons in a toolstrip. When a button is clicked it adds the appropriate User Control to my List<Control>. I then loop through that list creating either TabPages or mdi forms, with the user controls as children. I created an interface for these user controls so that I can ensure that they contain ...

How to load webusercontrol from classlibrary

I have a classlibrary. This library contains widget.ascx control. How to load this webusercontrol from web. I know "LoadControl". But this not applicable. How can i load web usercontrol from library? 2009.09.24 My main goal is i'm creating addon based web application. Every addon will be widget of web application. I need dynamicall...

How to pass a property from an ASP.Net page to a user control

I have created a user control which exposes a custom type property called SoftwareItem. The page where I have placed this user control has a page property of the same type. I cannot figure out how to pass the page's property to the user control. I understand that this can be done in the code_behind but wanted to set the property declarat...

Dymanic Controls C# Accessing without Name property

Hi to all, I have a panel, where my program is adding dynamic controls. Either I want to access these controls at runtime for changing their colors or texts. the only way I know is: Control [] myControls = myPanel.Controls.Find( name , true ); Here the problem is, my dynamic Controls have not any name ! Their name are " null ". If...

C# ASP.NET User control How to handle a div click server side?

I am creating an user control. The user control is a div and I want to add a click event to it. Edit: The page that has this control on it has to handle this event. How can I do this? ...

How to pass MVC User Controls Different Data

I have a user control I use multiple times on a page. It uniformly formats some object "X" and allows certain interactions. What I'd like to do is to pass a separate object to each separate instance of the user control. I'm currently rendering the controls as below, and just depending on some specific ViewData being set. I'd like to ...

How to set user control properties before it gets rendered?

I have a User Control (uc) on a page. uc exposes some properties that get set on Page_Load() event of the parent page, and should be read while user control loads up. Looks like Page_Load() of the uc fires before any properties get set from the parent page. On what event should I set the uc properties so that it can use those propertie...

UserControl OnPaint always has clipRect of {0,0,0,0}

I have a UserControl with a few buttons on it. I want to override OnPaint and paint some other stuff on the control. So I override OnPaint. Whenever OnPaint gets called the ClipRectangle is always {0,0,0,0} and so nothing I do gets drawn on the control. What am I doing wrong? ...

In WPF, how can I inherit from ToolBar AND have a XAML file?

I can inherit and enhance the ToolBar class by creating a plain C# class, then doing this: public class NiceToolBar : ToolBar { private ToolBarTray mainToolBarTray; public NiceToolBar() { mainToolBarTray = new ToolBarTray(); mainToolBarTray.IsLocked = true; this.Background = new SolidColorBrush(Colo...

WPF binding user control with data in C# code

I've create user control like this: public partial class View { public View() { InitializeComponent(); } public static DependencyProperty NameProperty = DependencyProperty.Register("Name", typeof(string), typeof(TeaserView) ); public string Name { get { return...

Event subscription to a static instance. How to ensure GC.

Hi. I'm fixing a User control component using the .NET 1.1 framework. There are many instances of this user control referencing a singleton wrapping a COM resource. They subscribe to events from this resource. I suspect that the reason why we are having a degrading performance is because the singleton is maintaining a reference to t...

UserControl - accessing textbox within UserControl within a web form

Hello all, I am using c#.net I have different views within my webform, these all generally display different information except for three textboxes (arrival / seen / depart time). To try and cut down on code, I have created a UserControl which contains these three textboxes. I have referenced the UserControl at the top of my webform a...

Reuse DNN modules in other applications

Hi, I had an application built on top of DNN. We created a few custom DNN modules for it. Now the functionality is required in another application that is not going to be built on DNN but on plain old ASP.NET. The question is that can the existing modules somehow be reused as is in other applications as plain UserControls somehow?? ...