usercontrols

Properties in User-Control Ctor are duplicated to the hosting form

An annoying behavior of Visual Studio (2008)'s designer is to duplicate any property of a control, which is set inside the control's constructor code to the InitializeComponent() method of the hosting form. For example, if I create a new user control and write the following line in its Ctor: this.Text = "Hard Coded Name"; then this sa...

Usercontrol property re-sets during binding

I have a curious problem with a .net usercontrol which is probably some page lifecycle issue that I've missed, but I'd be grateful for some advice. The control has a "showContributor" boolean property which is supposed to turn some columns in the display on or off. It consists of a repeater control containing other custom usercontrols t...

ValidationProperty not returning entered value for textbox in custom control

hi I have a custom control, (relevant code at the bottom) it consists of some text/links and a hidden textbox (rather than a hidden input). when rendered, the user via another dialog and some JS sets the value of the textbox to an integer and clicks submit on the form. i am trying to assure that the user has entered a number (via the JS...

question about c# asp.net

in order to use the FolderBrowserDialog control in asp.net, i had to add a reference to System.Windows.Forms in my project. i wrote this code: FolderBrowserDialog f = new FolderBrowserDialog(); f.ShowDialog(); but this error occured: Current thread must be set to single thread apartment (STA) mode before OLE calls can b...

DataGrid in UserControl --> Paging problem

Hi, I have a DataGrid in a USerControl. Somehow the paging doesnt work, the paging has the right amount of pages, but clicking the numbers does not work ... it stays on page 1. This is my Grid: <asp:DataGrid ID="DG_Grid" runat="server" AllowPaging="True" PageSize="10" EnableViewState="True" AllowSorting="False" DataKeyField=...

Alternatives to ASCX User Control without a server-side form?

I've got an ASP.NET 3.5 Web Forms application in which a large chunk of code needs to be duplicated between a few different pages. Sounds like the ideal candidate for a user-control right? Problem is, this cannot be contained within a <form runat="server"> because it contains a client-side form of it's own. There are no runat=server co...

[C# WinForms UserControl SerializationException] Why do I even need to Serialize in the first place?

So, I'm working with the following assembly, which has the following defined (fairly harmless): public class QueryDefinition { private List<QueryFilter> TheCurrentFilters = null; public List<QueryFilter> CurrentFilters { set { TheCurrentFilters = value; } get { return TheCurrentFilters; } } // other...

asp.net custom web user control -- button

Is it possible to create a custom button -- web user control? I want certain java scripts to trigger when buttons are clicked. If so, are there any articles out there that explain the basics? I completely understand that I can load javascript via .js link or dynamically at page load, but I would like to just drop a control on the page...

c# - create invisible user control

Hey, I need to create a user control in C#.Net, which can be added to the application without being visible - just like the FolderBrowserDialog. It's a new window which I'll be using often so I think this is the right way. The window will be opened by envoking the showDialog-Method as known from the other dialog. Any Idea? Thanks and r...

Custom UserControl property not being set via XAML DataBinding in Silverlight 4

I have a custom user control called GoalProgressControl. Another user control contains GoalProgressControl and sets its GoalName attribute via databinding in XAML. However, the GoalName property is never set. When I check it in debug mode GoalName remains "null" for the control's lifetime. How do I set the GoalName property? Is there so...

WPF UserControls - setting the .Command property on button inside UserControl

I've got a UserControl that contains a button and some other controls: <UserControl> <StackPanel> <Button x:Name="button" /> ... </StackPanel> </UserControl> When I create a new instance of that control, I want to get at the Button's Command property: <my:GreatUserControl TheButton.Command="{Binding SomeCommandHere}"> <...

SharePoint Webpart and ASP.NET User Control

I am developing SharePoint Web Parts for MOSS 2007 on Visual Studio 2008. Up until now, I've been adding all my controls by hand to the code behind... but an earlier post suggested I could use the designer to create an ASP.NET User Control, then add it to the webpart, and everything is happy... See figure 5 for an example. However, I c...

Problem to load a UserControl inside XAML node

I have a separated assembly where I defined several standard UserControls. Some of this are standard toolbars, like this: <UserControl x:Class="XXX.ToolbarFullMaintenance" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <ToolBar Style="{DynamicResource Toolba...

How To Create a Custom List of ProgressBars in .Net 2.0

I have created a progress bar custom control and would like to embed this into a list which can be sorted and placed on a windows form using .Net 2.0. What is the best approach for this? Is it possible to just add it to a ListView as a subitem? Is there a better way to achieve this? I want it to be as lightweight as possible. ...

How to style a custom Silverlight 4 UserControl ?

I have a custom UserControl that I created as a navigation menu that parses an xml file and populates itself with hyperlink buttons. So basically my control is an empty stackpanel, and when it's loaded it adds hyperlinkbuttons as children to the stack panel. In my application I just add a <myLibrary:NavigationMenu links="somexml.xml" />...

Adding ComboBoxItem to a combobox inside a user control (XAML/WPF)

I am currently learning to create custom controls in WPF. I successfully created a simple custom control using a Label and a Text Box. I was able to allow setting the Label text by DependencyProperty. Now I am creating a user control that has a ComboBox. I need to allow adding items to this ComboBox from outside the control. To achiev...

How to "bubble" a Controls features when place in a custom UserControl

I'll try to explain what Im after. I dont know the technical term for it, so here goes: Example 1: If I place a LisView on a Form and add som columns I am able, in Design-Time, to click-and-drag the columns to resize them. Example 2: Now, I place a ListView in a UserControl and name it "MyCustomListView" (and perhaps add some method to...

Insert Records in Radgrid using user control.

How can I insert in Radgrid using user control when I clock on the Add New Record. ...

Display dynamic Controls at run time

I want to display in a panel at run time different controls, depending on the menu selection. Any ideas? ...

WPF: Binding items added to UserControl's exposed children

I have a user control that allows items to be added to it by exposing a Grid's Children property. Any control I add shows up fine but when I try to bind a property on the added item to a control in the main window nothing happens (example): <TextBox Name="txtTest" Text="Success!" /> <mycontrols:CustomUserControl.ExposedGridChildren> ...