usercontrols

Placing the same ASP.NET control in different areas of a page.

I have some code that I've inherited, and it's not the greatest in the world, but it works, with one small exception: This page is a directory search, it has controls identified by record ID, however there exists a situation where there can be more than one result with the same record ID, thus making .NET barf. I had originally impleme...

WPF window hosting usercontrol

Hi, I have a usercontrol that I use to edit some objects in my application. I have recently come to an instance where I want to pop up a new dialog (window) which will host this usercontrol. How do I instantiate the new window and pass any properties that need to be set from the window to the usercontrol? Thanks for your time. ...

Should a User Control's Controls be backed by Properties?

Hopefully I am stating that right. I have a WinForm(3.5) app that has 1 Form that is broke into two regions. 1 is the Navigation and the other, a Panel, is the Content. You select what you want in the Navigation Portion, i.e. Demographics, and then it embeds a UserControl containing all the Demographics controls in the Panel. What I ...

WinForms UserControl inheritance in .Net Compact Framework

The full .Net framework has an inherited UserControl but this option isn't offered by Visual Studio when creating a new control in a Compact Framework project. Manually changing the ancestor class of a user control to another user control results in an exception being thrown by the designer when subsequently trying to open it. Anyone k...

Changing UserControl background based on SelectedValue from combobox

What I try to do: I have a list of person profiles in the background that I use with my combobox. The trigger is to change the background based on the gender of the person (bool Role.IsFemale). When I handle the SelectionChangedEvent in the code, I can see the Selectedvalue is true or false. I could now change the background directly or ...

Link Button on ASP.NET user control not firing

Hi I have a user control, which is added to another user control. The nested user control is built up of a GridView, an image button and a link button. The nested user control is added to the outer control as a collection object based upon the results bound to the GridView. The problem that I have is that my link button doesn't work....

Is there a performance difference between custom server controls and user controls?

Consider two controls that do basically the same things. For instance, a gridview-like-widget with paging, sorting, and data caching. Both bound with the same 10,000 row data source. One is a custom server control and one is a user control. Is there any reason there would be any difference in performance? Just wondering that the communi...

UserControlArray in Specific ButtonControlArray in C#

I am new to C#.I have been thinking of adding a ButtonControlArray where i can store each button control.Here is part of my code.I am creating a 6*6 array of button Control. ButtonControl buttonControl; ButtonControl[,] arrayButtons = new ButtonControl[6,6]; public void createGrid() { l = 0; f...

Referencing functions within VB6 User Controls

I'm having an issue referencing public procedures of User Controls that I've created within a VB6 project. A simple example (exe), I have a form with a button and a user control: Option Explicit Private Sub Command1_Click() UserControl1.updateMessage ("TIME NOW: " & DateTime.Time) End Sub The User Control code is as follows: Op...

WPF usercontrol

Hi, I've got a parent UserControl which has a property which I would like to access from a child usercontrol of the parent. Is this possible? I'll be doing this through the child control's viewmodel. Just wanted to get an idea on the best approach to do this. Thankyou. ...

Dynamically Loaded User Control's Page_Load event Doesn't Fire from Handler. Why?

Hi Guys I have a handler (.ashx) file that I'm using to deal with Requests. Depending on the type of output needed, I want to load a user control that will present the data in the correct format. I thought that when I created the instance of MyUC its load event would fire, but i guess not. I've even tried specifying my own event handl...

WPF datacontext parent / child usercontrols

I have a WPF application that is made up of a window containing a usercontrol which, in turn, contains another child usercontrol. I have a dependencyProperty for a SelectedName in my second usercontrol's viewmodel. I want the parent control to be able to either access this property and display the SelectedName in a textblock in the par...

How to Serialize a ASP.NET UserControl

I have a application with a GridView, this GridView have, in your PagerTemplate, a GridViewPager which is an UserControl. Now i'am trying to store this GridViewPager in a ViewState and i'am having a problem with serialization. Asp.Net tell me that the class is not marked as serializable. I try to mark it as serializable, like this: nam...

C# set UserControl.Value without invoking the ValueChanged event

I running into an infinite loop problem. I have two numeric up/down controls (Height and Width input parameters). When the user changes the value of one of the controls, I need to scale the other to keep a height to width ratio constant. Is there a way to set the value of a control without invoking a ValueChanged Event. I only want t...

Text Box Databinding in a Winform App, what am I missing

I am trying to implement some very simple Data Binding in my User Control that runs in a WinForm app. The User Control is extended like so --> public partial class ucDiagnosis : XtraUserControl, INotifyPropertyChanged Then on that User Control I have this Property --> private string m_Pets; public string Pets { ...

Child control view model event

Hi, I seem to have got stuck in a situation where I have a parent and child usercontrol. I want to be able to raise an event in the child and have the parent handle this event. How do I trigger the event in my child view model and handle it in the parent view model. If anybody has a simple example that would be really good. Thanks v...

Factory Pattern for User Controls

I created a ASP.NET user control, and was wanting to create a factory with a method that allowed a control to be created via several parameters. Originally I was going to have a constructor on the user control with the parameters, but the parameters are really only provided to make creating the user control easier from some legacy cod...

How to reuse this in WPF?

It should look like this: I don't care about reusing it in other applications that need somewhat different looks. It's just for display Content needs to wrap, maximum 3 lines. I'm trying to implement it as a derived class of UserControl with XAML defining the visual elements, but I'm not sure if that's the best option. So how wou...

Create Instance of a UserControl in ASHX Handler Where ASCX Depends on a Parent ASPX.

Hi all I found this extremely useful article on creating instances of ASP.NET UserControls in .ASHX Handlers by Scott Guthrie. Unfortunately I now have a requirement now where I need to create an instance of a UserControl which has a dependency on the parent page. This being the case, I can't use the same method to create the UserContr...

ProcessCmdKey doesn't trap event in usercontrol

I'd like to handle the Enter button in my TextBox inside ListBox in UserControl (not Form!). There are a lot of answers and samples for the case. The most common is to override ProcessCmdKey() or IsInputKey() in CustomTextBox inherited from TextBox: public class CustomizedTextBox : System.Windows.Forms.TextBox { protected override b...